예제 #1
0
        public void TestNotIsIgnored()
        {
            Expression <Func <TestObject, bool> > func = (x) => !(x.Name == "test");
            IndexBuilderVisitor indexBuilderVisitor    = new IndexBuilderVisitor();

            indexBuilderVisitor.Visit(func);

            var filters = indexBuilderVisitor.Filters;

            Dictionary <string, List <object> > expected = new Dictionary <string, List <object> >()
            {
            };

            filters.Should().BeEquivalentTo(expected);
        }
예제 #2
0
        public void TestInnerObjectPropertyEquals()
        {
            Expression <Func <TestObject, bool> > func = (x) => x.InnerObject.Test == "test";
            IndexBuilderVisitor indexBuilderVisitor    = new IndexBuilderVisitor();

            indexBuilderVisitor.Visit(func);

            var filters = indexBuilderVisitor.Filters;

            Dictionary <string, List <object> > expected = new Dictionary <string, List <object> >()
            {
                { "InnerObject.Test", new List <object>()
                  {
                      "test"
                  } }
            };

            filters.Should().BeEquivalentTo(expected);
        }
예제 #3
0
        public void TestOrIsIgnored()
        {
            List <string> containsValues = new List <string>()
            {
                "test1", "test2", "test3"
            };
            Expression <Func <TestObject, bool> > func = (x) => x.Name == "test" || containsValues.Contains(x.Name);
            IndexBuilderVisitor indexBuilderVisitor    = new IndexBuilderVisitor();

            indexBuilderVisitor.Visit(func);

            var filters = indexBuilderVisitor.Filters;

            Dictionary <string, List <object> > expected = new Dictionary <string, List <object> >()
            {
            };

            filters.Should().BeEquivalentTo(expected);
        }
예제 #4
0
        public void TestSinglePropertyMultipleEquals()
        {
            Expression <Func <TestObject, bool> > func = (x) => x.Name == "test" && x.Name == "test2";
            IndexBuilderVisitor indexBuilderVisitor    = new IndexBuilderVisitor();

            indexBuilderVisitor.Visit(func);

            var filters = indexBuilderVisitor.Filters;

            Dictionary <string, List <object> > expected = new Dictionary <string, List <object> >()
            {
                { "Name", new List <object>()
                  {
                      "test", "test2"
                  } }
            };

            filters.Should().BeEquivalentTo(expected);
        }