예제 #1
0
        public void EvaluateOnNoAttributeChange()
        {
            Guid newId = Guid.NewGuid();

            try
            {
                MAObjectHologram maObject = ActiveConfig.DB.CreateMAObject(newId, "person");
                maObject.CommitCSEntryChange();

                CSEntryChange csentry = CSEntryChange.Create();
                csentry.DN = maObject.ObjectID.ToString();
                csentry.ObjectModificationType = ObjectModificationType.Update;
                csentry.ObjectType             = maObject.ObjectClass.Name;

                // Positive Tests
                AttributeChangeRule target = new AttributeChangeRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("accountName");
                target.TriggerEvents = TriggerEvents.None;
                bool actual = target.Evaluate(maObject);
                Assert.IsTrue(actual);


                // Negative Tests
                csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd("accountName", "mytestvalue"));
                maObject.AttachCSEntryChange(csentry);

                target               = new AttributeChangeRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("accountName");
                target.TriggerEvents = TriggerEvents.None;
                actual               = target.Evaluate(maObject);
                Assert.IsFalse(actual);
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }