Example #1
0
        public void TestEqualFilter_String_NotEqualValue()
        {
            var instance = new EqualFilterTestClass
            {
                S = "string"
            };
            var list = new List <EqualFilterTestClass>();

            list.Add(instance);

            var filter = new EqualFilter <EqualFilterTestClass>("S", "abc");

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

            Assert.AreEqual(0, results.Count);
        }
Example #2
0
        public void TestToWhereExpression_DifferentNumericTypes()
        {
            var instance = new EqualFilterTestClass
            {
                Int = 1
            };
            var list = new List <EqualFilterTestClass>();

            list.Add(instance);

            var filter = new EqualFilter <EqualFilterTestClass>("Int", 1L);

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

            Assert.AreEqual(1, results.Count);
        }
Example #3
0
        public void TestEqualFilter_NullableDate_EqualValue()
        {
            var instance = new EqualFilterTestClass
            {
                NullableDate = DateTime.UtcNow
            };
            var list = new List <EqualFilterTestClass>();

            list.Add(instance);

            var filter = new EqualFilter <EqualFilterTestClass>("NullableDate", instance.NullableDate);

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

            Assert.AreEqual(1, results.Count);
        }
Example #4
0
        public void TestEqualFilter_NullableDateTimeOffset_NotEqualValue()
        {
            var instance = new EqualFilterTestClass
            {
                NullableDTOffset = DateTimeOffset.Now
            };
            var list = new List <EqualFilterTestClass>();

            list.Add(instance);

            var filter = new EqualFilter <EqualFilterTestClass>("NullableDTOffset", instance.NullableDTOffset.Value.AddDays(1.0));

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

            Assert.AreEqual(0, results.Count);
        }
Example #5
0
        public void TestEqualFilter_NullableInteger_NotEqualValue()
        {
            var instance = new EqualFilterTestClass
            {
                NullableInt = 1
            };
            var list = new List <EqualFilterTestClass>();

            list.Add(instance);

            var filter = new EqualFilter <EqualFilterTestClass>("NullableInt", 0);

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

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