Exemplo n.º 1
0
        public void PropertyAsSyntaxCriterion()
        {
            ICriteria expected =
                CreateTestCriteria(typeof(Person))
                .Add(Subqueries.PropertyEq("Name", DetachedCriteriaName));

            var actual =
                CreateTestQueryOver <Person>()
                .And(Subqueries.Where <Person>(p => p.Name == DetachedQueryOverName.As <string>()));

            AssertCriteriaAreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void PropertyAsSyntaxAliasCriterion()
        {
            ICriteria expected =
                CreateTestCriteria(typeof(Person), "personAlias")
                .Add(Subqueries.PropertyEq("personAlias.Name", DetachedCriteriaName))
                .Add(Subqueries.PropertyGtSome("personAlias.Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyLtAll("personAlias.Age", DetachedCriteriaAge));

            Person personAlias = null;
            var    actual      =
                CreateTestQueryOver <Person>(() => personAlias)
                .And(Subqueries.Where(() => personAlias.Name == DetachedQueryOverName.As <string>()))
                .And(Subqueries.WhereSome(() => personAlias.Age > DetachedQueryOverAge.As <int>()))
                .And(Subqueries.WhereAll(() => personAlias.Age < DetachedQueryOverAge.As <int>()));

            AssertCriteriaAreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void PropertyAsAllSyntaxCriterion()
        {
            ICriteria expected =
                CreateTestCriteria(typeof(Person))
                .Add(Subqueries.PropertyEqAll("Name", DetachedCriteriaName))
                .Add(Subqueries.PropertyGeAll("Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyGtAll("Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyLeAll("Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyLtAll("Age", DetachedCriteriaAge));

            var actual =
                CreateTestQueryOver <Person>()
                .And(Subqueries.WhereAll <Person>(p => p.Name == DetachedQueryOverName.As <string>()))
                .And(Subqueries.WhereAll <Person>(p => p.Age >= DetachedQueryOverAge.As <int>()))
                .And(Subqueries.WhereAll <Person>(p => p.Age > DetachedQueryOverAge.As <int>()))
                .And(Subqueries.WhereAll <Person>(p => p.Age <= DetachedQueryOverAge.As <int>()))
                .And(Subqueries.WhereAll <Person>(p => p.Age < DetachedQueryOverAge.As <int>()));

            AssertCriteriaAreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void PropertyAsSyntax()
        {
            ICriteria expected =
                CreateTestCriteria(typeof(Person))
                .Add(Subqueries.PropertyEq("Name", DetachedCriteriaName))
                .Add(Subqueries.PropertyNe("Name", DetachedCriteriaName))
                .Add(Subqueries.PropertyGe("Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyGt("Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyLe("Age", DetachedCriteriaAge))
                .Add(Subqueries.PropertyLt("Age", DetachedCriteriaAge));

            var actual =
                CreateTestQueryOver <Person>()
                .WithSubquery.Where(p => p.Name == DetachedQueryOverName.As <string>())
                .WithSubquery.Where(p => p.Name != DetachedQueryOverName.As <string>())
                .WithSubquery.Where(p => p.Age >= DetachedQueryOverAge.As <int>())
                .WithSubquery.Where(p => p.Age > DetachedQueryOverAge.As <int>())
                .WithSubquery.Where(p => p.Age <= DetachedQueryOverAge.As <int>())
                .WithSubquery.Where(p => p.Age < DetachedQueryOverAge.As <int>());

            AssertCriteriaAreEqual(expected, actual);
        }