public void SingleNotEqualsCondition() { ObjectTransaction transaction = manager.BeginTransaction(); Query query = new Query(new Condition("Boolean", Expression.NotEqual, false)); ServerObjectCollection objects = transaction.Select(typeof(SimpleConstraintTestObject), query); Assert.AreEqual(2, objects.Count); SimpleConstraintTestObject object1 = objects[0] as SimpleConstraintTestObject; Assert.AreEqual(2, object1.Id); Assert.AreEqual("GHT", object1.Varchar); Assert.AreEqual(5, object1.Integer); Assert.AreEqual(true, object1.Boolean); Assert.AreEqual(new DateTime(1945, 8, 1), object1.Date); Assert.AreEqual(2, object1.NullableInteger); SimpleConstraintTestObject object2 = objects[1] as SimpleConstraintTestObject; Assert.AreEqual(4, object2.Id); Assert.AreEqual("kp", object2.Varchar); Assert.AreEqual(100, object2.Integer); Assert.AreEqual(true, object2.Boolean); Assert.AreEqual(new DateTime(2004, 10, 1), object2.Date); Assert.AreEqual(-1, object2.NullableInteger); }
public void DoubleCommit() { ObjectTransaction transaction1 = manager.BeginTransaction(); SimpleConstraintTestObject obj1 = transaction1.Select(typeof(SimpleConstraintTestObject), 1) as SimpleConstraintTestObject; obj1.Varchar = "XXX"; transaction1.Commit(); obj1.Varchar = "YYY"; transaction1.Commit(); ObjectTransaction transaction2 = manager.BeginTransaction(); SimpleConstraintTestObject obj2 = transaction2.Select(typeof(SimpleConstraintTestObject), 1) as SimpleConstraintTestObject; Assert.AreEqual("YYY", obj2.Varchar); }
public void DoubleEqualsCondition() { ObjectTransaction transaction = manager.BeginTransaction(); Query query = new Query(new Condition("Boolean", Expression.Equal, true), new Condition("Id", Expression.Equal, 4)); ServerObjectCollection objects = transaction.Select(typeof(SimpleConstraintTestObject), query); Assert.AreEqual(1, objects.Count); SimpleConstraintTestObject object1 = objects[0] as SimpleConstraintTestObject; Assert.AreEqual(4, object1.Id); Assert.AreEqual("kp", object1.Varchar); Assert.AreEqual(100, object1.Integer); Assert.AreEqual(true, object1.Boolean); Assert.AreEqual(new DateTime(2004, 10, 1), object1.Date); Assert.AreEqual(-1, object1.NullableInteger); }
public void SingleNotLikeAndGreaterThanCondition() { ObjectTransaction transaction = manager.BeginTransaction(); Query query = new Query(new Condition("Varchar", Expression.NotLike, "k%"), new Condition("Integer", Expression.GreaterThan, 5)); ServerObjectCollection objects = transaction.Select(typeof(SimpleConstraintTestObject), query); Assert.AreEqual(1, objects.Count); SimpleConstraintTestObject object1 = objects[0] as SimpleConstraintTestObject; Assert.AreEqual(1, object1.Id); Assert.AreEqual("AX", object1.Varchar); Assert.AreEqual(6, object1.Integer); Assert.AreEqual(false, object1.Boolean); Assert.AreEqual(new DateTime(1981, 7, 11), object1.Date); Assert.AreEqual(1, object1.NullableInteger); }