コード例 #1
0
        public void Test___Method_Check___False___Generic()
        {
            var testee = new NotEqualsCondition <int>()
            {
                Value1 = new AnyVariable <int>()
                {
                    Value = 10
                },
                Value2 = new AnyVariable <int>()
                {
                    Value = 10
                }
            };

            Assert.IsFalse(testee.Check());
        }
コード例 #2
0
        public void Test___Method_Check___True()
        {
            var testee = new NotEqualsCondition()
            {
                Value1 = new AnyVariable()
                {
                    Value = 10
                },
                Value2 = new AnyVariable()
                {
                    Value = 20
                }
            };

            Assert.IsTrue(testee.Check());
        }
コード例 #3
0
        public void AndConditionTest(
            string attr1,
            object value1,
            string attr2,
            object value2,
            bool expectedMatch)
        {
            var condition1 = new EqualsCondition(attr1, value1);
            var condition2 = new NotEqualsCondition(attr2, value2);

            ICondition[] subConditions = { condition1, condition2 };
            var          or            = new AndCondition(subConditions);

            var rule = new Rule(or, _onMatchAction);

            rule.Execute(_event);
            Assert.AreEqual(expectedMatch, _isMatch);
        }
コード例 #4
0
        public void EqualConditionTest(
            string attributeName,
            object expectedValue,
            bool expectedMatch)
        {
            // test EqualsCondition
            var condition = new EqualsCondition(attributeName, expectedValue);
            var rule      = new Rule(condition, _onMatchAction);

            rule.Execute(_event);
            Assert.AreEqual(expectedMatch, _isMatch);

            // now reverse expectations and test NotEqualsCondition
            var oppositeCondition = new NotEqualsCondition(attributeName, expectedValue);

            // reset, just in case
            _isMatch = false;
            rule     = new Rule(oppositeCondition, _onMatchAction);
            rule.Execute(_event);
            Assert.AreEqual(!expectedMatch, _isMatch);
        }