예제 #1
0
        public void TestGetWhereExpression_IsNotNullCheck_NullablePropertyHasValue()
        {
            var list     = new List <NullFilterTestClass>();
            var instance = new NullFilterTestClass
            {
                S = "hello"
            };

            list.Add(instance);
            var filter = new NullFilter <NullFilterTestClass>("S", true);

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

            Assert.AreEqual(1, results.Count);
        }
예제 #2
0
        public void TestGetWhereExpression_DefaultIsNullCheck_NullablePropertyIsNull()
        {
            var list     = new List <NullFilterTestClass>();
            var instance = new NullFilterTestClass
            {
                S = null
            };

            list.Add(instance);
            var filter = new NullFilter <NullFilterTestClass>("S");

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

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