Esempio n. 1
0
        public void CompareShouldIgnoreSetOnlyProperty()
        {
            var entity = new Entity();
            var testee = new CustomOperator("");
            var left   = new BlankOperand();
            var right  = new Operand(Expression.Constant(true), typeof(bool));

            testee.Compare(Expression.Constant(entity), left, right);

            CollectionAssert.AreEqual(new string[] { "Both:Get", "GetOnly:Get" }, entity.CalledProperties);
            Assert.AreEqual(2, testee.CompareCalledCount);
        }
Esempio n. 2
0
        public void CompareShouldNotEvaluatePropertyWhenLeftOperandIsNotBlank()
        {
            var entity = new Entity();
            var testee = new CustomOperator("");
            var left   = new Operand(Expression.Constant(true), typeof(bool));
            var right  = new Operand(Expression.Constant(true), typeof(bool));

            testee.Compare(Expression.Constant(entity), left, right);

            Assert.AreEqual(0, entity.CalledProperties.Count);
            Assert.AreEqual(1, testee.CompareCalledCount);
        }