public void Entities_InterceptWith_StringComparisonVisitor_CurrentCulture()
        {
            _context.Blogs.Add(new Blog {
                Name = "A"
            });
            _context.Blogs.Add(new Blog {
                Name = "a"
            });
            _context.SaveChanges();

            IQueryable <Blog> query = _context.Blogs.AsQueryable();

            var visitor = new StringComparisonVisitor(StringComparison.CurrentCulture);

            List <Blog> queryIntercepted1 = query.InterceptWith(visitor).Where(b => b.Name == "A").ToList();

            Assert.Equal(new List <string> {
                "A"
            }, queryIntercepted1.Select(b => b.Name).ToList());

            List <Blog> queryIntercepted2 = query.InterceptWith(visitor).Where(b => b.Name == "a").ToList();

            Assert.Equal(new List <string> {
                "a"
            }, queryIntercepted2.Select(b => b.Name).OrderBy(x => x).ToList());
        }
Esempio n. 2
0
        public void InterceptWith_TestSetComparerExpressionVisitor_CurrentCulture()
        {
            IQueryable <string> query = new List <string> {
                "A", "a"
            }.AsQueryable();

            var visitor = new StringComparisonVisitor(StringComparison.CurrentCulture);

            List <string> queryIntercepted1 = query.InterceptWith(visitor).Where(s => s == "A").ToList();

            Assert.Equal(new List <string> {
                "A"
            }, queryIntercepted1);

            List <string> queryIntercepted2 = query.InterceptWith(visitor).Where(s => s == "a").ToList();

            Assert.Equal(new List <string> {
                "a"
            }, queryIntercepted2);
        }