Esempio n. 1
0
        public void ModifyFilterIfCompletedDisallowed_ShouldReturnTheSameExpr()
        {
            // arrange
            Expression <Func <ToDo, bool> > exp = todo => false;
            // act
            var returned = CompletedFilterModifierHelper.ModifyFilterIfCompletedDisallowed(exp, false);

            // assert
            Assert.Equal(exp, returned);
        }
Esempio n. 2
0
        public void ModifyFilterIfCompletedDisallowed_ShouldReturnModifiedExpr(bool returnValue, bool isCompleted)
        {
            // arrange
            Expression <Func <ToDo, bool> > exp = todo => returnValue;
            var todo = new ToDo {
                IsCompleted = isCompleted
            };
            // act
            var returned = CompletedFilterModifierHelper.ModifyFilterIfCompletedDisallowed(exp, true);
            // assert
            var lambda = returned.Compile();

            Assert.Equal(returnValue && !isCompleted, lambda(todo));
        }