Example #1
0
        public void EvaluateOnSVAttributePresentCurrent()
        {
            Guid newId = Guid.NewGuid();

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

                // Positive Tests
                AttributePresenceRule target = new AttributePresenceRule();
                target.Attribute = ActiveConfig.DB.GetAttribute("accountName");
                target.Operator  = PresenceOperator.IsPresent;
                target.View      = HologramView.Current;
                Assert.IsTrue(target.Evaluate(maObject));

                // Negative Tests
                target           = new AttributePresenceRule();
                target.Attribute = ActiveConfig.DB.GetAttribute("accountName");
                target.Operator  = PresenceOperator.NotPresent;
                target.View      = HologramView.Current;
                Assert.IsFalse(target.Evaluate(maObject));
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }
Example #2
0
        public void EvaluateOnMVAttributePresentProposed()
        {
            Guid newId = Guid.NewGuid();

            try
            {
                MAObjectHologram maObject = ActiveConfig.DB.CreateMAObject(newId, "person");
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("directReports"), new List <object> {
                    Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                });

                // Positive Tests
                AttributePresenceRule target = new AttributePresenceRule();
                target.Attribute = ActiveConfig.DB.GetAttribute("directReports");
                target.Operator  = PresenceOperator.IsPresent;
                target.View      = HologramView.Proposed;
                Assert.IsTrue(target.Evaluate(maObject));

                // Negative Tests
                target           = new AttributePresenceRule();
                target.Attribute = ActiveConfig.DB.GetAttribute("directReports");
                target.Operator  = PresenceOperator.NotPresent;
                target.View      = HologramView.Proposed;
                Assert.IsFalse(target.Evaluate(maObject));
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }