コード例 #1
0
        public void BuildEqualExpression()
        {
            //Arrange
            List <Person> people = FakeData.People();

            Expression <Func <Person, bool> > express = PredicateBuilder.BuildEqual <Person>("Age", 70);

            Func <Person, bool> func = express.Compile();

            var result = people.Where(func);

            var expectedResult = people.Where(p => p.Age == 70);

            Assert.That(result.Count(), Is.EqualTo(expectedResult.Count()));
        }