public void EvaluateSVAVRStringEqualsProposedTest()
        {
            bool expected = true;
            bool actual;
            Guid newId = Guid.NewGuid();

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

                ValueComparisonRule target = new ValueComparisonRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("mail");
                target.ValueOperator = ValueOperator.Equals;
                target.ExpectedValue = new ValueDeclaration("*****@*****.**");
                target.View          = HologramView.Proposed;

                // Positive Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("mail"), "*****@*****.**");
                actual = target.Evaluate(maObject);
                Assert.AreEqual(expected, actual);

                // Negative Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("mail"), "*****@*****.**");
                actual = target.Evaluate(maObject);
                Assert.AreNotEqual(expected, actual);
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }
        public void EvaluateSVAVRBinaryEqualsTest()
        {
            bool expected = true;
            bool actual;
            Guid newId = Guid.NewGuid();

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

                ValueComparisonRule target = new ValueComparisonRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("objectSid");
                target.ValueOperator = ValueOperator.Equals;
                target.ExpectedValue = new ValueDeclaration("AAECAwQ=");

                // Positive Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("objectSid"), new byte[] { 0, 1, 2, 3, 4 });
                actual = target.Evaluate(maObject);
                Assert.AreEqual(expected, actual);

                // Negative Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("objectSid"), new byte[] { 0, 0, 0, 3, 4 });
                actual = target.Evaluate(maObject);
                Assert.AreNotEqual(expected, actual);
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }
        public void EvaluateSVAVRLongEqualsTest()
        {
            bool expected = true;
            bool actual;

            Guid newId = Guid.NewGuid();

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

                ValueComparisonRule target = new ValueComparisonRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("sapExpiryDate");
                target.ValueOperator = ValueOperator.Equals;
                target.ExpectedValue = new ValueDeclaration("1234567890");

                // Positive Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("sapExpiryDate"), 1234567890L);
                actual = target.Evaluate(maObject);
                Assert.AreEqual(expected, actual);

                // Negative Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("sapExpiryDate"), 9876543210L);
                actual = target.Evaluate(maObject);
                Assert.AreNotEqual(expected, actual);
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }
        public void EvaluateSVAVRDateTimeEqualsTest()
        {
            bool expected = true;
            bool actual;

            Guid newId = Guid.NewGuid();

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

                ValueComparisonRule target = new ValueComparisonRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("dateTimeSV");
                target.ValueOperator = ValueOperator.Equals;
                target.ExpectedValue = new ValueDeclaration("2010-01-01");

                // Positive Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("dateTimeSV"), DateTime.Parse("2010-01-01"));
                actual = target.Evaluate(maObject);
                Assert.AreEqual(expected, actual);

                // Negative Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("dateTimeSV"), DateTime.Parse("2011-01-01"));
                actual = target.Evaluate(maObject);
                Assert.AreNotEqual(expected, actual);
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }
        public void EvaluateMVAVRNoMatchTest()
        {
            bool actual;
            bool expected = true;

            Guid newId = Guid.NewGuid();

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

                ValueComparisonRule target = new ValueComparisonRule();
                target.Attribute     = ActiveConfig.DB.GetAttribute("mailAlternateAddresses");
                target.ValueOperator = ValueOperator.Equals;
                target.GroupOperator = GroupOperator.None;
                target.ExpectedValue = new ValueDeclaration("*****@*****.**");


                // Positive Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("mailAlternateAddresses"), new List <object>()
                {
                    "*****@*****.**", "*****@*****.**", "*****@*****.**"
                });
                actual = target.Evaluate(maObject);
                Assert.AreEqual(expected, actual);

                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("mailAlternateAddresses"), new List <object>()
                {
                    "*****@*****.**"
                });
                actual = target.Evaluate(maObject);
                Assert.AreEqual(expected, actual);

                // Negative Tests
                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("mailAlternateAddresses"), new List <object>()
                {
                    "*****@*****.**", "*****@*****.**", "*****@*****.**"
                });
                actual = target.Evaluate(maObject);
                Assert.AreNotEqual(expected, actual);

                maObject.SetAttributeValue(ActiveConfig.DB.GetAttribute("mailAlternateAddresses"), new List <object>()
                {
                    "*****@*****.**"
                });
                actual = target.Evaluate(maObject);
                Assert.AreNotEqual(expected, actual);
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(newId);
            }
        }