public void When_counting_Then_works()
        {
            var odataQuery = Helpers.Build <Parent>("$count?$filter=Id ne 0 and Children/any(entity:entity/Parent/Id eq 61)");
            var records    = this._session.Query <Parent>();

            records = FixOdataQueryAttribute.ApplyFix(records);

            var results = odataQuery.ApplyTo(records).Cast <Parent>().LongCount();

            Assert.That(results, Is.EqualTo(1));
        }
Exemplo n.º 2
0
        public void When_filtering_children_Then_generates_proper_nhibernate_query(string filter, int resultCount)
        {
            var odataQuery = Helpers.Build <Child>(filter);
            var children   = this._session.Query <Child>();

            children = FixOdataQueryAttribute.ApplyFix(children);

            var results = odataQuery.ApplyTo(children).Cast <Child>().ToList();

            Assert.That(results, Has.Count.EqualTo(resultCount));
        }
Exemplo n.º 3
0
        public void When_applying_fixes_statically_Then_works()
        {
            var data = TestData.GetTestChildren();

            var results = FixOdataQueryAttribute.ApplyFix(data).ToList();

            Assert.That(results, Has.Count.EqualTo(1));

            var results2 = FixOdataQueryAttribute.ApplyFixWithoutGeneric(data).Cast <object>().ToList();

            Assert.That(results2, Has.Count.EqualTo(1));
        }