예제 #1
0
        public void TestToWhereExpression_IntProperty_SingleNotInFilter_MultipleListValues()
        {
            var testValue       = 1;
            var secondTestValue = 2;
            var list            = new List <NotInFilterTestClass>();

            list.Add(new NotInFilterTestClass
            {
                Id = testValue
            });
            list.Add(new NotInFilterTestClass
            {
                Id = secondTestValue
            });

            var testInList = new List <int> {
                testValue
            };
            var filter = new NotInFilter <NotInFilterTestClass>("Id", testInList);

            var where = filter.ToWhereExpression();
            var results = list.Where(where.Compile()).ToList();

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual(secondTestValue, results.First().Id);
        }
예제 #2
0
        public void TestToWhereExpression_NullableIntProperty_MultipleNotInFilters_NullValue()
        {
            var testValue       = 1;
            var secondTestValue = 2;
            var list            = new List <NotInFilterTestClass>();

            list.Add(new NotInFilterTestClass
            {
                Id         = 1,
                NullableId = null
            });
            list.Add(new NotInFilterTestClass
            {
                Id         = 2,
                NullableId = null
            });

            var testInList = new List <int> {
                testValue, secondTestValue
            };
            var filter = new NotInFilter <NotInFilterTestClass>("NullableId", testInList);

            var where = filter.ToWhereExpression();
            var results = list.Where(where.Compile()).ToList();

            Assert.AreEqual(2, results.Count);
        }