Exemplo n.º 1
0
 public CriteriaContext() : base(NHConfig.OpenSession(), NHConfig.Configuration)
 {
     _pc = new ODataParserConfiguration()
     {
         CaseSensitive = false
     };
 }
Exemplo n.º 2
0
        public void InsensitiveLikeDoesNotThrow()
        {
            var configuration = new ODataParserConfiguration
            {
                CaseSensitiveLike = false
            };

            Verify <Parent>("substringof('cde', LengthString)", q => q.Where(p => p.LengthString.IsInsensitiveLike("cde", MatchMode.Anywhere)), configuration);
            Verify <Parent>("startswith(LengthString, 'abcde')", q => q.Where(p => p.LengthString.IsInsensitiveLike("abcde", MatchMode.Start)), configuration);
            Verify <Parent>("endswith(LengthString, 'cde')", q => q.Where(p => p.LengthString.IsInsensitiveLike("cde", MatchMode.End)), configuration);
        }
Exemplo n.º 3
0
        public void InsensitiveLikeDoesNotThrow()
        {
            var configuration = new ODataParserConfiguration
            {
                CaseSensitiveLike = false
            };

            Verify<Parent>("substringof('cde', LengthString)", q => q.Where(p => p.LengthString.IsInsensitiveLike("cde", MatchMode.Anywhere)), configuration);
            Verify<Parent>("startswith(LengthString, 'abcde')", q => q.Where(p => p.LengthString.IsInsensitiveLike("abcde", MatchMode.Start)), configuration);
            Verify<Parent>("endswith(LengthString, 'cde')", q => q.Where(p => p.LengthString.IsInsensitiveLike("cde", MatchMode.End)), configuration);
        }
Exemplo n.º 4
0
        protected void Verify <T>(string filter, IList <T> expected, bool ordered, ODataParserConfiguration configuration)
            where T : class, IEntity
        {
            var actual = Session.ODataQuery <T>(GetQueryString(filter), configuration).List <T>();

            if (actual.Count == 0)
            {
                throw new InvalidOperationException("Query returned zero results");
            }

            if (ordered)
            {
                Assert.That(actual, Is.EqualTo(expected));
            }
            else
            {
                Assert.That(actual, Is.EquivalentTo(expected));
            }
        }
Exemplo n.º 5
0
 protected void VerifyOrdered <T>(string filter, Func <IQueryOver <T, T>, IQueryOver <T, T> > query, ODataParserConfiguration configuration)
     where T : class, IEntity
 {
     Verify(filter, query(Session.QueryOver <T>()).List(), true, configuration);
 }
Exemplo n.º 6
0
 protected void Verify <T>(string filter, IList <T> expected, ODataParserConfiguration configuration)
     where T : class, IEntity
 {
     Verify(filter, expected, false, configuration);
 }