Exemplo n.º 1
0
        private static RuleGroup GetOneGroupTwoMatches()
        {
            ObjectClassScopeProviderForTest provider = new ObjectClassScopeProviderForTest("person");

            RuleGroup target = new RuleGroup();

            target.ObjectClassScopeProvider = provider;
            target.Operator = GroupOperator.One;
            ValueComparisonRule rule1 = new ValueComparisonRule();

            rule1.Attribute     = ActiveConfig.DB.GetAttribute("mail");
            rule1.ValueOperator = ValueOperator.Equals;
            rule1.ExpectedValue = new ValueDeclaration("*****@*****.**");
            target.Items.Add(rule1);

            ValueComparisonRule rule2 = new ValueComparisonRule();

            rule2.Attribute     = ActiveConfig.DB.GetAttribute("mail");
            rule2.ValueOperator = ValueOperator.Equals;
            rule2.ExpectedValue = new ValueDeclaration("*****@*****.**");
            target.Items.Add(rule2);

            ValueComparisonRule rule3 = new ValueComparisonRule();

            rule3.Attribute     = ActiveConfig.DB.GetAttribute("mail");
            rule3.ValueOperator = ValueOperator.Equals;
            rule3.ExpectedValue = new ValueDeclaration("*****@*****.**");
            target.Items.Add(rule3);

            return(target);
        }
Exemplo n.º 2
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);
        }