public CriteriaContext() : base(NHConfig.OpenSession(), NHConfig.Configuration) { _pc = new ODataParserConfiguration() { CaseSensitive = false }; }
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); }
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); }
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)); } }
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); }
protected void Verify <T>(string filter, IList <T> expected, ODataParserConfiguration configuration) where T : class, IEntity { Verify(filter, expected, false, configuration); }