コード例 #1
0
        public void TestSerialization()
        {
            AcmaExternalExitEventCmd toSerialize = new AcmaExternalExitEventCmd();

            toSerialize.ID        = "test external event";
            toSerialize.RuleGroup = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            toSerialize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });
            toSerialize.CommandLine = "cmd.exe";
            toSerialize.Arguments   = new ValueDeclaration("/c dir >> testfile.txt");
            Lithnet.Common.ObjectModel.UniqueIDCache.ClearIdCache();

            AcmaExternalExitEventCmd deserialized = UnitTestControl.XmlSerializeRoundTrip <AcmaExternalExitEventCmd>(toSerialize);

            Assert.AreEqual(toSerialize.ID, deserialized.ID);
            Assert.AreEqual(toSerialize.RuleGroup.Operator, deserialized.RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)toSerialize.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)deserialized.RuleGroup.Items[0]).TriggerEvents);
            Assert.AreEqual(toSerialize.CommandLine, deserialized.CommandLine);
            Assert.AreEqual(toSerialize.Arguments.Declaration, deserialized.Arguments.Declaration);
        }
コード例 #2
0
        public void TestSerialization()
        {
            SequentialIntegerAllocationConstructor toSeralize = new SequentialIntegerAllocationConstructor();

            toSeralize.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            toSeralize.ID          = "abc12355";
            toSeralize.Description = "some description";
            toSeralize.Sequence    = ActiveConfig.DB.GetSequence("unixUid");
            toSeralize.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            toSeralize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });
            UniqueIDCache.ClearIdCache();

            SequentialIntegerAllocationConstructor deserialized = UnitTestControl.XmlSerializeRoundTrip <SequentialIntegerAllocationConstructor>(toSeralize);

            Assert.AreEqual(toSeralize.Attribute, deserialized.Attribute);
            Assert.AreEqual(toSeralize.ID, deserialized.ID);
            Assert.AreEqual(toSeralize.Description, deserialized.Description);
            Assert.AreEqual(toSeralize.Sequence, deserialized.Sequence);
            Assert.AreEqual(toSeralize.RuleGroup.Operator, deserialized.RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)toSeralize.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)deserialized.RuleGroup.Items[0]).TriggerEvents);
        }
コード例 #3
0
        public void TestSerialization()
        {
            ObjectChangeRule toSeralize = new ObjectChangeRule();

            toSeralize.TriggerEvents = TriggerEvents.Delete | TriggerEvents.Add;

            ObjectChangeRule deserialized = (ObjectChangeRule)UnitTestControl.XmlSerializeRoundTrip <ObjectChangeRule>(toSeralize);

            Assert.AreEqual(toSeralize.TriggerEvents, deserialized.TriggerEvents);
        }
コード例 #4
0
        public void TestSerialization()
        {
            DBQueryByValue toSeralize = new DBQueryByValue(ActiveConfig.DB.GetAttribute("sn"), ValueOperator.Equals, ActiveConfig.DB.GetAttribute("firstName"));

            toSeralize.Description = "attribute";

            DBQueryByValue deserialized = (DBQueryByValue)UnitTestControl.XmlSerializeRoundTrip <DBQueryByValue>(toSeralize);

            Assert.AreEqual(toSeralize.Description, deserialized.Description);
            Assert.AreEqual(toSeralize.Operator, deserialized.Operator);
            Assert.AreEqual(toSeralize.SearchAttribute, deserialized.SearchAttribute);
            Assert.AreEqual(toSeralize.ValueDeclarations[0].Declaration, deserialized.ValueDeclarations[0].Declaration);
        }
コード例 #5
0
ファイル: EventRuleTest.cs プロジェクト: ryannewington/acma
        public void TestSerialization()
        {
            EventRule toSeralize = new EventRule();

            toSeralize.EventName   = "attribute";
            toSeralize.EventSource = ActiveConfig.DB.GetAttribute("supervisor");
            UniqueIDCache.ClearIdCache();

            EventRule deserialized = (EventRule)UnitTestControl.XmlSerializeRoundTrip <EventRule>(toSeralize);

            Assert.AreEqual(toSeralize.EventName, deserialized.EventName);
            Assert.AreEqual(toSeralize.EventSource, deserialized.EventSource);
        }
コード例 #6
0
        public void TestSerialization()
        {
            AttributePresenceRule toSeralize = new AttributePresenceRule();

            toSeralize.Attribute = ActiveConfig.DB.GetAttribute("sn");
            toSeralize.Operator  = PresenceOperator.IsPresent;
            toSeralize.View      = HologramView.Proposed;
            AttributePresenceRule deserialized = (AttributePresenceRule)UnitTestControl.XmlSerializeRoundTrip <AttributePresenceRule>(toSeralize);

            Assert.AreEqual(toSeralize.Attribute, deserialized.Attribute);
            Assert.AreEqual(toSeralize.Operator, deserialized.Operator);
            Assert.AreEqual(toSeralize.View, deserialized.View);
        }
コード例 #7
0
        public void TestSerialization()
        {
            ObjectClassScopeProviderForTest provider   = new ObjectClassScopeProviderForTest("person");
            AttributeChangeRule             toSeralize = new AttributeChangeRule();

            toSeralize.ObjectClassScopeProvider = provider;
            toSeralize.Attribute     = ActiveConfig.DB.GetAttribute("sn");
            toSeralize.TriggerEvents = TriggerEvents.Add | TriggerEvents.Delete;

            AttributeChangeRule deserialized = (AttributeChangeRule)UnitTestControl.XmlSerializeRoundTrip <AttributeChangeRule>(toSeralize);

            deserialized.ObjectClassScopeProvider = provider;
            Assert.AreEqual(toSeralize.Attribute, deserialized.Attribute);
            Assert.AreEqual(toSeralize.TriggerEvents, deserialized.TriggerEvents);
            Assert.IsTrue(deserialized.ErrorCount == 0);
        }
コード例 #8
0
        public void TestSerializationComplex()
        {
            RuleGroup group1 = new RuleGroup();

            group1.Operator = GroupOperator.Any;

            ObjectChangeRule test1 = new ObjectChangeRule();

            test1.TriggerEvents = TriggerEvents.Add;
            group1.Items.Add(test1);

            ObjectChangeRule test2 = new ObjectChangeRule();

            test2.TriggerEvents = TriggerEvents.Delete;
            group1.Items.Add(test2);

            RuleGroup group2 = new RuleGroup();

            group2.Operator = GroupOperator.One;

            ObjectChangeRule test3 = new ObjectChangeRule();

            test3.TriggerEvents = TriggerEvents.Add;
            group2.Items.Add(test3);

            ObjectChangeRule test4 = new ObjectChangeRule();

            test4.TriggerEvents = TriggerEvents.Delete;
            group2.Items.Add(test4);

            group1.Items.Add(group2);

            RuleGroup deserializedGroup1 = (RuleGroup)UnitTestControl.XmlSerializeRoundTrip <RuleGroup>(group1);

            Assert.AreEqual(group1.Items.Count, deserializedGroup1.Items.Count);
            Assert.AreEqual(group1.Operator, deserializedGroup1.Operator);
            Assert.AreEqual(((ObjectChangeRule)deserializedGroup1.Items[0]).TriggerEvents, test1.TriggerEvents);
            Assert.AreEqual(((ObjectChangeRule)deserializedGroup1.Items[1]).TriggerEvents, test2.TriggerEvents);
            Assert.AreEqual(((RuleGroup)deserializedGroup1.Items[2]).Items.Count, group2.Items.Count);

            RuleGroup deserializedGroup2 = (RuleGroup)deserializedGroup1.Items[2];

            Assert.AreEqual(group2.Operator, deserializedGroup2.Operator);

            Assert.AreEqual(((ObjectChangeRule)(deserializedGroup2.Items[0])).TriggerEvents, test3.TriggerEvents);
            Assert.AreEqual(((ObjectChangeRule)(deserializedGroup2.Items[1])).TriggerEvents, test4.TriggerEvents);
        }
コード例 #9
0
        public void TestSerialization()
        {
            ValueComparisonRule toSeralize = new ValueComparisonRule();

            toSeralize.Attribute     = ActiveConfig.DB.GetAttribute("firstName");
            toSeralize.ExpectedValue = new ValueDeclaration("test");
            toSeralize.ValueOperator = ValueOperator.Equals;
            toSeralize.View          = HologramView.Proposed;

            ValueComparisonRule deserialized = (ValueComparisonRule)UnitTestControl.XmlSerializeRoundTrip <ValueComparisonRule>(toSeralize);

            Assert.AreEqual(toSeralize.Attribute, deserialized.Attribute);
            Assert.AreEqual(toSeralize.ExpectedValue.Declaration, deserialized.ExpectedValue.Declaration);
            Assert.AreEqual(toSeralize.ExpectedValue.TransformsString, deserialized.ExpectedValue.TransformsString);
            Assert.AreEqual(toSeralize.ValueOperator, deserialized.ValueOperator);
            Assert.AreEqual(toSeralize.View, deserialized.View);
        }
コード例 #10
0
        public void TestSerialization()
        {
            AdvancedComparisonRule toSeralize = new AdvancedComparisonRule();

            toSeralize.CompareAs     = ExtendedAttributeType.DateTime;
            toSeralize.SourceValue   = new ValueDeclaration("test1");
            toSeralize.TargetValue   = new ValueDeclaration("test2");
            toSeralize.ValueOperator = ValueOperator.NotContains;
            toSeralize.GroupOperator = GroupOperator.None;

            AdvancedComparisonRule deserialized = (AdvancedComparisonRule)UnitTestControl.XmlSerializeRoundTrip <AdvancedComparisonRule>(toSeralize);

            Assert.AreEqual(toSeralize.CompareAs, deserialized.CompareAs);
            Assert.AreEqual(toSeralize.SourceValue.Declaration, deserialized.SourceValue.Declaration);
            Assert.AreEqual(toSeralize.TargetValue.Declaration, deserialized.TargetValue.Declaration);
            Assert.AreEqual(toSeralize.ValueOperator, deserialized.ValueOperator);
            Assert.AreEqual(toSeralize.GroupOperator, deserialized.GroupOperator);
        }
コード例 #11
0
        public void TestSerialization()
        {
            RuleGroup toSeralize = new RuleGroup();

            toSeralize.Operator = GroupOperator.Any;
            ObjectChangeRule test1 = new ObjectChangeRule();

            test1.TriggerEvents = TriggerEvents.Add;
            toSeralize.Items.Add(test1);

            ObjectChangeRule test2 = new ObjectChangeRule();

            test2.TriggerEvents = TriggerEvents.Delete;
            toSeralize.Items.Add(test2);

            RuleGroup deserialized = (RuleGroup)UnitTestControl.XmlSerializeRoundTrip <RuleGroup>(toSeralize);

            Assert.AreEqual(toSeralize.Items.Count, deserialized.Items.Count);
            Assert.AreEqual(toSeralize.Operator, deserialized.Operator);
            Assert.AreEqual(((ObjectChangeRule)deserialized.Items[0]).TriggerEvents, test1.TriggerEvents);
            Assert.AreEqual(((ObjectChangeRule)deserialized.Items[1]).TriggerEvents, test2.TriggerEvents);
        }
コード例 #12
0
        public void TestSerialization()
        {
            AcmaInternalExitEvent toSerialize = new AcmaInternalExitEvent();

            toSerialize.ID        = "testName";
            toSerialize.RuleGroup = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            toSerialize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });
            toSerialize.Recipients.Add(ActiveConfig.DB.GetAttribute("supervisor"));
            toSerialize.Recipients.Add(ActiveConfig.DB.GetAttribute("directReports"));
            toSerialize.RecipientQueries = new ObservableCollection <DBQueryObject>();
            DBQueryGroup group = new DBQueryGroup();

            group.Operator = GroupOperator.Any;
            toSerialize.RecipientQueries.Add(group);
            group.DBQueries.Add(new DBQueryByValue(ActiveConfig.DB.GetAttribute("sn"), ValueOperator.EndsWith, ActiveConfig.DB.GetAttribute("firstName")));

            Lithnet.Common.ObjectModel.UniqueIDCache.ClearIdCache();
            AcmaInternalExitEvent deserialized = UnitTestControl.XmlSerializeRoundTrip <AcmaInternalExitEvent>(toSerialize);

            Assert.AreEqual(toSerialize.ID, deserialized.ID);
            Assert.AreEqual(toSerialize.RuleGroup.Operator, deserialized.RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)toSerialize.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)deserialized.RuleGroup.Items[0]).TriggerEvents);
            CollectionAssert.AreEqual(toSerialize.Recipients, deserialized.Recipients);

            DBQueryGroup deserializedGroup = toSerialize.RecipientQueries[0] as DBQueryGroup;

            Assert.AreEqual(group.Operator, deserializedGroup.Operator);
            Assert.AreEqual(((DBQueryByValue)group.DBQueries[0]).SearchAttribute, ((DBQueryByValue)deserializedGroup.DBQueries[0]).SearchAttribute);
            Assert.AreEqual(((DBQueryByValue)group.DBQueries[0]).Operator, ((DBQueryByValue)deserializedGroup.DBQueries[0]).Operator);
            Assert.AreEqual(((DBQueryByValue)group.DBQueries[0]).ValueDeclarations[0].Declaration, ((DBQueryByValue)deserializedGroup.DBQueries[0]).ValueDeclarations[0].Declaration);
        }
コード例 #13
0
        public void TestSerialization()
        {
            ReferenceLookupConstructor toSeralize = new ReferenceLookupConstructor();

            toSeralize.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            toSeralize.ID          = "abc123";
            toSeralize.Description = "some description";
            toSeralize.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            toSeralize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });
            toSeralize.MultipleResultAction = MultipleResultAction.UseFirst;
            toSeralize.QueryGroup           = new DBQueryGroup()
            {
                Operator = GroupOperator.None
            };
            toSeralize.QueryGroup.DBQueries.Add(new DBQueryByValue(ActiveConfig.DB.GetAttribute("sn"), ValueOperator.EndsWith, ActiveConfig.DB.GetAttribute("firstName")));
            UniqueIDCache.ClearIdCache();
            ReferenceLookupConstructor deserialized = UnitTestControl.XmlSerializeRoundTrip <ReferenceLookupConstructor>(toSeralize);

            Assert.AreEqual(toSeralize.Attribute, deserialized.Attribute);
            Assert.AreEqual(toSeralize.ID, deserialized.ID);
            Assert.AreEqual(toSeralize.Description, deserialized.Description);
            Assert.AreEqual(toSeralize.MultipleResultAction, deserialized.MultipleResultAction);
            Assert.AreEqual(toSeralize.RuleGroup.Operator, deserialized.RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)toSeralize.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)deserialized.RuleGroup.Items[0]).TriggerEvents);

            Assert.AreEqual(toSeralize.QueryGroup.Operator, deserialized.QueryGroup.Operator);
            Assert.AreEqual(((DBQueryByValue)toSeralize.QueryGroup.DBQueries[0]).SearchAttribute, ((DBQueryByValue)deserialized.QueryGroup.DBQueries[0]).SearchAttribute);
            Assert.AreEqual(((DBQueryByValue)toSeralize.QueryGroup.DBQueries[0]).Operator, ((DBQueryByValue)deserialized.QueryGroup.DBQueries[0]).Operator);
            Assert.AreEqual(((DBQueryByValue)toSeralize.QueryGroup.DBQueries[0]).ValueDeclarations[0].Declaration, ((DBQueryByValue)deserialized.QueryGroup.DBQueries[0]).ValueDeclarations[0].Declaration);
        }
コード例 #14
0
        public void TestSerialization()
        {
            AttributeValueDeleteConstructor toSeralize = new AttributeValueDeleteConstructor();

            toSeralize.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            toSeralize.ID          = "abc1235645645";
            toSeralize.Description = "some description";
            toSeralize.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.All
            };
            toSeralize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Add
            });
            Lithnet.Common.ObjectModel.UniqueIDCache.ClearIdCache();
            AttributeValueDeleteConstructor deserialized = UnitTestControl.XmlSerializeRoundTrip <AttributeValueDeleteConstructor>(toSeralize);

            Assert.AreEqual(toSeralize.Attribute, deserialized.Attribute);
            Assert.AreEqual(toSeralize.ID, deserialized.ID);
            Assert.AreEqual(toSeralize.Description, deserialized.Description);
            Assert.AreEqual(toSeralize.RuleGroup.Operator, deserialized.RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)toSeralize.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)deserialized.RuleGroup.Items[0]).TriggerEvents);
        }
コード例 #15
0
 public ValueComparisonRuleTest()
 {
     UnitTestControl.Initialize();
 }
コード例 #16
0
 public CSEntryChangeHelperTests()
 {
     UnitTestControl.Initialize();
 }
コード例 #17
0
 public VariableDeclarationParserTests()
 {
     UnitTestControl.Initialize();
 }
コード例 #18
0
        public void TestSerialization()
        {
            UniqueIDCache.ClearIdCache();
            AttributeValueDeleteConstructor constructorToSerialize1 = new AttributeValueDeleteConstructor();

            constructorToSerialize1.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            constructorToSerialize1.ID          = "abc123";
            constructorToSerialize1.Description = "some description";
            constructorToSerialize1.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            constructorToSerialize1.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });

            AttributeValueDeleteConstructor constructorToSerialize2 = new AttributeValueDeleteConstructor();

            constructorToSerialize2.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            constructorToSerialize2.ID          = "abc1234";
            constructorToSerialize2.Description = "some description";
            constructorToSerialize2.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.All
            };
            constructorToSerialize2.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Add
            });

            AttributeConstructorGroup groupToSerialize = new AttributeConstructorGroup();

            groupToSerialize.Description   = "my description";
            groupToSerialize.ID            = "myID";
            groupToSerialize.ExecutionRule = GroupExecutionRule.ExitAfterFirstSuccess;
            groupToSerialize.RuleGroup     = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            groupToSerialize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });
            groupToSerialize.Constructors.Add(constructorToSerialize1);
            groupToSerialize.Constructors.Add(constructorToSerialize2);

            UniqueIDCache.ClearIdCache();

            AttributeConstructorGroup deserializedGroup = UnitTestControl.XmlSerializeRoundTrip <AttributeConstructorGroup>(groupToSerialize);

            Assert.AreEqual(groupToSerialize.ExecutionRule, deserializedGroup.ExecutionRule);
            Assert.AreEqual(groupToSerialize.ID, deserializedGroup.ID);
            Assert.AreEqual(groupToSerialize.Description, deserializedGroup.Description);
            Assert.AreEqual(groupToSerialize.RuleGroup.Operator, deserializedGroup.RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)groupToSerialize.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)deserializedGroup.RuleGroup.Items[0]).TriggerEvents);

            Assert.AreEqual(constructorToSerialize1.Attribute, ((AttributeConstructor)deserializedGroup.Constructors[0]).Attribute);
            Assert.AreEqual(constructorToSerialize1.ID, ((AttributeConstructor)deserializedGroup.Constructors[0]).ID);
            Assert.AreEqual(constructorToSerialize1.Description, ((AttributeConstructor)deserializedGroup.Constructors[0]).Description);
            Assert.AreEqual(constructorToSerialize1.RuleGroup.Operator, ((AttributeConstructor)deserializedGroup.Constructors[0]).RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)constructorToSerialize1.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)((AttributeConstructor)deserializedGroup.Constructors[0]).RuleGroup.Items[0]).TriggerEvents);

            Assert.AreEqual(constructorToSerialize2.Attribute, ((AttributeConstructor)deserializedGroup.Constructors[1]).Attribute);
            Assert.AreEqual(constructorToSerialize2.ID, ((AttributeConstructor)deserializedGroup.Constructors[1]).ID);
            Assert.AreEqual(constructorToSerialize2.Description, ((AttributeConstructor)deserializedGroup.Constructors[1]).Description);
            Assert.AreEqual(constructorToSerialize2.RuleGroup.Operator, ((AttributeConstructor)deserializedGroup.Constructors[1]).RuleGroup.Operator);
            Assert.AreEqual(((ObjectChangeRule)constructorToSerialize2.RuleGroup.Items[0]).TriggerEvents, ((ObjectChangeRule)((AttributeConstructor)deserializedGroup.Constructors[1]).RuleGroup.Items[0]).TriggerEvents);
        }
コード例 #19
0
 public AdvancedComparisonRuleTest()
 {
     UnitTestControl.Initialize();
 }
コード例 #20
0
        public void TestSerialization()
        {
            AttributeValueDeleteConstructor constructorToSerialize1 = new AttributeValueDeleteConstructor();

            constructorToSerialize1.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            constructorToSerialize1.ID          = "abc123";
            constructorToSerialize1.Description = "some description";
            constructorToSerialize1.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            constructorToSerialize1.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });

            AttributeValueDeleteConstructor constructorToSerialize2 = new AttributeValueDeleteConstructor();

            constructorToSerialize2.Attribute   = ActiveConfig.DB.GetAttribute("sn");
            constructorToSerialize2.ID          = "abc123";
            constructorToSerialize2.Description = "some description";
            constructorToSerialize2.RuleGroup   = new RuleGroup()
            {
                Operator = GroupOperator.All
            };
            constructorToSerialize2.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Add
            });

            AttributeConstructorGroup groupToSerialize = new AttributeConstructorGroup();

            groupToSerialize.Description   = "my description";
            groupToSerialize.ID            = "myID";
            groupToSerialize.ExecutionRule = GroupExecutionRule.ExitAfterFirstSuccess;
            groupToSerialize.RuleGroup     = new RuleGroup()
            {
                Operator = GroupOperator.Any
            };
            groupToSerialize.RuleGroup.Items.Add(new ObjectChangeRule()
            {
                TriggerEvents = TriggerEvents.Delete
            });
            groupToSerialize.Constructors.Add(constructorToSerialize1);

            ClassConstructor classConstructorToSerialize = new ClassConstructor();

            classConstructorToSerialize.ObjectClass = ActiveConfig.DB.GetObjectClass("person");
            classConstructorToSerialize.ExitEvents.Add(new AcmaInternalExitEvent()
            {
                ID = "testName"
            });
            classConstructorToSerialize.Constructors.Add(groupToSerialize);
            classConstructorToSerialize.Constructors.Add(constructorToSerialize2);

            classConstructorToSerialize.ResurrectionParameters          = new DBQueryGroup();
            classConstructorToSerialize.ResurrectionParameters.Operator = GroupOperator.Any;
            classConstructorToSerialize.ResurrectionParameters.DBQueries.Add(new DBQueryByValue(ActiveConfig.DB.GetAttribute("sn"), ValueOperator.Equals, new ValueDeclaration("test")));
            classConstructorToSerialize.ResurrectionParameters.DBQueries.Add(new DBQueryByValue(ActiveConfig.DB.GetAttribute("sn"), ValueOperator.Equals, ActiveConfig.DB.GetAttribute("sn")));

            XmlConfigFile toSerialize = new XmlConfigFile();

            toSerialize.ClassConstructors.Add(classConstructorToSerialize);
            toSerialize.Transforms = new TransformKeyedCollection();
            toSerialize.Transforms.Add(new TrimStringTransform()
            {
                TrimType = TrimType.Both, ID = "trimboth"
            });
            UniqueIDCache.ClearIdCache();

            XmlConfigFile deserialized = UnitTestControl.XmlSerializeRoundTrip <XmlConfigFile>(toSerialize);

            Assert.AreEqual(toSerialize.ClassConstructors.Count, deserialized.ClassConstructors.Count);
            Assert.AreEqual(toSerialize.Transforms.Count, deserialized.Transforms.Count);
        }
コード例 #21
0
 public XmlConfigFileTests()
 {
     UnitTestControl.Initialize();
 }
コード例 #22
0
        public void TestSerialization()
        {
            AcmaCSEntryChange toSerialize = new AcmaCSEntryChange();

            toSerialize.ObjectModificationType = ObjectModificationType.Update;
            toSerialize.ObjectType             = "person";
            toSerialize.DN = "testDN";
            toSerialize.AttributeChanges.Add(AttributeChange.CreateAttributeAdd("sn", "myValue"));
            toSerialize.AttributeChanges.Add(AttributeChange.CreateAttributeAdd("mailAlternateAddresses", new List <object>()
            {
                "myValue1", "myValue2"
            }));
            toSerialize.AttributeChanges.Add(AttributeChange.CreateAttributeDelete("accountName"));
            toSerialize.AttributeChanges.Add(AttributeChange.CreateAttributeReplace("activeExpiryDate", 900L));
            toSerialize.AttributeChanges.Add(AttributeChange.CreateAttributeUpdate("displayName", new List <ValueChange>()
            {
                ValueChange.CreateValueAdd("addValue"), ValueChange.CreateValueDelete("deleteValue")
            }));
            toSerialize.AnchorAttributes.Add(AnchorAttribute.Create("myAnchor1", "99"));
            toSerialize.AnchorAttributes.Add(AnchorAttribute.Create("myAnchor2", "my second test anchor"));


            AcmaCSEntryChange deserialized = UnitTestControl.XmlSerializeRoundTrip <AcmaCSEntryChange>(toSerialize);

            Assert.AreEqual(toSerialize.ObjectModificationType, deserialized.ObjectModificationType);
            Assert.AreEqual(toSerialize.ObjectType, deserialized.ObjectType);
            Assert.AreEqual(toSerialize.DN, deserialized.DN);

            Assert.AreEqual(toSerialize.AttributeChanges[0].Name, deserialized.AttributeChanges[0].Name);
            Assert.AreEqual(toSerialize.AttributeChanges[0].ModificationType, deserialized.AttributeChanges[0].ModificationType);
            Assert.AreEqual(toSerialize.AttributeChanges[0].ValueChanges[0].Value, deserialized.AttributeChanges[0].ValueChanges[0].Value);
            Assert.AreEqual(toSerialize.AttributeChanges[0].ValueChanges[0].ModificationType, deserialized.AttributeChanges[0].ValueChanges[0].ModificationType);

            Assert.AreEqual(toSerialize.AttributeChanges[1].Name, deserialized.AttributeChanges[1].Name);
            Assert.AreEqual(toSerialize.AttributeChanges[1].ModificationType, deserialized.AttributeChanges[1].ModificationType);
            Assert.AreEqual(toSerialize.AttributeChanges[1].ValueChanges[0].Value, deserialized.AttributeChanges[1].ValueChanges[0].Value);
            Assert.AreEqual(toSerialize.AttributeChanges[1].ValueChanges[0].ModificationType, deserialized.AttributeChanges[1].ValueChanges[0].ModificationType);
            Assert.AreEqual(toSerialize.AttributeChanges[1].ValueChanges[1].Value, deserialized.AttributeChanges[1].ValueChanges[1].Value);
            Assert.AreEqual(toSerialize.AttributeChanges[1].ValueChanges[1].ModificationType, deserialized.AttributeChanges[1].ValueChanges[1].ModificationType);

            Assert.AreEqual(toSerialize.AttributeChanges[2].Name, deserialized.AttributeChanges[2].Name);
            Assert.AreEqual(toSerialize.AttributeChanges[2].ModificationType, deserialized.AttributeChanges[2].ModificationType);

            Assert.AreEqual(toSerialize.AttributeChanges[3].Name, deserialized.AttributeChanges[3].Name);
            Assert.AreEqual(toSerialize.AttributeChanges[3].ModificationType, deserialized.AttributeChanges[3].ModificationType);
            Assert.AreEqual(toSerialize.AttributeChanges[3].ValueChanges[0].Value, deserialized.AttributeChanges[3].ValueChanges[0].Value);
            Assert.AreEqual(toSerialize.AttributeChanges[3].ValueChanges[0].ModificationType, deserialized.AttributeChanges[3].ValueChanges[0].ModificationType);

            Assert.AreEqual(toSerialize.AttributeChanges[4].Name, deserialized.AttributeChanges[4].Name);
            Assert.AreEqual(toSerialize.AttributeChanges[4].ModificationType, deserialized.AttributeChanges[4].ModificationType);
            Assert.AreEqual(toSerialize.AttributeChanges[4].ValueChanges[0].Value, deserialized.AttributeChanges[4].ValueChanges[0].Value);
            Assert.AreEqual(toSerialize.AttributeChanges[4].ValueChanges[0].ModificationType, deserialized.AttributeChanges[4].ValueChanges[0].ModificationType);
            Assert.AreEqual(toSerialize.AttributeChanges[4].ValueChanges[1].Value, deserialized.AttributeChanges[4].ValueChanges[1].Value);
            Assert.AreEqual(toSerialize.AttributeChanges[4].ValueChanges[1].ModificationType, deserialized.AttributeChanges[4].ValueChanges[1].ModificationType);

            Assert.AreEqual(toSerialize.AnchorAttributes[0].Name, deserialized.AnchorAttributes[0].Name);
            Assert.AreEqual(toSerialize.AnchorAttributes[0].Value, deserialized.AnchorAttributes[0].Value);

            Assert.AreEqual(toSerialize.AnchorAttributes[1].Name, deserialized.AnchorAttributes[1].Name);
            Assert.AreEqual(toSerialize.AnchorAttributes[1].Value, deserialized.AnchorAttributes[1].Value);
        }
コード例 #23
0
 public static void InitializeTest(TestContext testContext)
 {
     UnitTestControl.Initialize();
 }
コード例 #24
0
 public MultivaluedAttributeValueRuleTest()
 {
     UnitTestControl.Initialize();
 }
コード例 #25
0
 public VariableDeclarationTest()
 {
     UnitTestControl.Initialize();
 }
コード例 #26
0
ファイル: EventRuleTest.cs プロジェクト: ryannewington/acma
 public EventRuleTest()
 {
     UnitTestControl.Initialize();
 }
コード例 #27
0
 public TransformParserTests()
 {
     UnitTestControl.Initialize();
 }
コード例 #28
0
 public AttributeConstructorGroupTests()
 {
     UnitTestControl.Initialize();
 }
コード例 #29
0
 public AcmaCSEntryChangeTest()
 {
     UnitTestControl.Initialize();
 }
コード例 #30
0
 public AttributePresenceRuleTest()
 {
     UnitTestControl.Initialize();
 }