public void ValueCriterion() { ICriteria expected = CreateTestCriteria(typeof(Person)) .Add(Subqueries.Eq("Name", DetachedCriteriaName)) .Add(Subqueries.Ge("Age", DetachedCriteriaAge)) .Add(Subqueries.Gt("Age", DetachedCriteriaAge)) .Add(Subqueries.In("Name", DetachedCriteriaName)) .Add(Subqueries.Le("Age", DetachedCriteriaAge)) .Add(Subqueries.Lt("Age", DetachedCriteriaAge)) .Add(Subqueries.Ne("Name", DetachedCriteriaName)) .Add(Subqueries.NotIn("Name", DetachedCriteriaName)); var actual = CreateTestQueryOver <Person>() .And(Subqueries.WhereValue("Name").Eq(DetachedQueryOverName)) .And(Subqueries.WhereValue("Age").Ge(DetachedQueryOverAge)) .And(Subqueries.WhereValue("Age").Gt(DetachedQueryOverAge)) .And(Subqueries.WhereValue("Name").In(DetachedQueryOverName)) .And(Subqueries.WhereValue("Age").Le(DetachedQueryOverAge)) .And(Subqueries.WhereValue("Age").Lt(DetachedQueryOverAge)) .And(Subqueries.WhereValue("Name").Ne(DetachedQueryOverName)) .And(Subqueries.WhereValue("Name").NotIn(DetachedQueryOverName)); AssertCriteriaAreEqual(expected, actual); }
public void SubqueriesExpressions() { DetachedCriteria dc = DetachedCriteria.For(typeof(Student)) .Add(Expression.Eq("Name", "Gavin King")); ICriterion c = Subqueries.Eq("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.EqAll("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.Exists(dc); NHAssert.IsSerializable(c); c = Subqueries.Ge("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.GeAll("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.GeSome("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.Gt("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.GtAll("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.GtSome("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.In("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.Le("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.LeAll("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.LeSome("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.Lt("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.LtAll("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.LtSome("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.Ne("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.NotExists(dc); NHAssert.IsSerializable(c); c = Subqueries.NotIn("Gavin King", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyEq("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyEqAll("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyGe("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyGeAll("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyGeSome("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyGt("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyGtAll("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyGtSome("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyIn("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyLe("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyLeAll("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyLeSome("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyLt("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyLtAll("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyLtSome("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyNe("Name", dc); NHAssert.IsSerializable(c); c = Subqueries.PropertyNotIn("Name", dc); NHAssert.IsSerializable(c); }