public void DeleteRandomValues() { int count = DataUtil.CountRows("NullableCharacters"); ObjectTransaction transaction1 = manager.BeginTransaction(); NullableCharacterTestObject test1 = transaction1.Create(typeof(NullableCharacterTestObject)) as NullableCharacterTestObject; test1.Char = "z"; test1.NChar = "z"; test1.VChar = "zzz"; test1.NVChar = "zzz"; test1.Text = "zzz"; test1.NText = "zzz"; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("NullableCharacters")); ObjectTransaction transaction2 = manager.BeginTransaction(); NullableCharacterTestObject test2 = transaction2.Select(typeof(NullableCharacterTestObject), test1.Id) as NullableCharacterTestObject; Assert.AreEqual(test1.Id, test2.Id); Assert.AreEqual("z", test2.Char); Assert.AreEqual("z", test2.NChar); Assert.AreEqual("zzz", test2.VChar); Assert.AreEqual("zzz", test2.NVChar); Assert.AreEqual("zzz", test2.Text); Assert.AreEqual("zzz", test2.NText); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("NullableCharacters")); }
public void DeleteRandomValues() { Random random = new Random(); int count = DataUtil.CountRows("Binary"); ObjectTransaction transaction = manager.BeginTransaction(); BinaryTestObject test1 = transaction.Create(typeof(BinaryTestObject)) as BinaryTestObject; test1.Binary = new byte[8]; random.NextBytes(test1.Binary); test1.VarBinary = new byte[5]; random.NextBytes(test1.VarBinary); test1.Image = new byte[1024]; random.NextBytes(test1.Image); transaction.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("Binary")); ObjectTransaction transaction2 = manager.BeginTransaction(); BinaryTestObject test2 = transaction2.Select(typeof(BinaryTestObject), test1.Id) as BinaryTestObject; Assert.AreEqual(8, test2.Binary.Length); Assert.AreEqual(5, test2.VarBinary.Length); Assert.AreEqual(1024, test2.Image.Length); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("Binary")); }
public void Delete() { int count = DataUtil.CountRows("GuidKeys"); ObjectTransaction transaction1 = manager.BeginTransaction(); GuidKeyTestObject test1 = transaction1.Create(typeof(GuidKeyTestObject)) as GuidKeyTestObject; test1.ObjData = 169; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("GuidKeys")); ObjectTransaction transaction2 = manager.BeginTransaction(); GuidKeyTestObject test2 = transaction2.Select(typeof(GuidKeyTestObject), test1.Id) as GuidKeyTestObject; Assert.AreEqual(test1.Id, test2.Id); Assert.AreEqual(169, test2.ObjData); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("GuidKeys")); }
public void Delete() { int count = DataUtil.CountRows("IdentityKeys"); ObjectTransaction transaction1 = manager.BeginTransaction(); IdentityKeyTestObject test1 = transaction1.Create(typeof(IdentityKeyTestObject)) as IdentityKeyTestObject; Assert.AreEqual(-1, test1.Id); test1.ObjData = "blah"; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("IdentityKeys")); ObjectTransaction transaction2 = manager.BeginTransaction(); IdentityKeyTestObject test2 = transaction2.Select(typeof(IdentityKeyTestObject), test1.Id) as IdentityKeyTestObject; Assert.AreEqual(test1.Id, test2.Id); Assert.AreEqual("blah", test2.ObjData); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("IdentityKeys")); }
public void DeleteRandomValues() { int count = DataUtil.CountRows("NullableDateTimes"); ObjectTransaction transaction1 = manager.BeginTransaction(); NullableDateTimeTestObject test1 = transaction1.Create(typeof(NullableDateTimeTestObject)) as NullableDateTimeTestObject; test1.Date = DateTime.Today.AddDays(-30); test1.SmallDate = DateTime.Today.AddMonths(1); transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("NullableDateTimes")); ObjectTransaction transaction2 = manager.BeginTransaction(); NullableDateTimeTestObject test2 = transaction2.Select(typeof(NullableDateTimeTestObject), test1.Id) as NullableDateTimeTestObject; Assert.AreEqual(DateTime.Today.AddDays(-30), test2.Date); Assert.AreEqual(DateTime.Today.AddMonths(1), test2.SmallDate); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("NullableDateTimes")); }
public void DeleteRandomValues() { int count = DataUtil.CountRows("FloatingPointNumbers"); ObjectTransaction transaction1 = manager.BeginTransaction(); FloatingPointNumberTestObject test1 = transaction1.Create(typeof(FloatingPointNumberTestObject)) as FloatingPointNumberTestObject; test1.Decimal = 1.565m; test1.Numeric = 565m; test1.Float = -1.25; test1.Real = 126; test1.Money = -65.65m; test1.SmallMoney = 23.545m; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("FloatingPointNumbers")); ObjectTransaction transaction2 = manager.BeginTransaction(); FloatingPointNumberTestObject test2 = transaction2.Select(typeof(FloatingPointNumberTestObject), test1.Id) as FloatingPointNumberTestObject; Assert.AreEqual(2, test2.Decimal); Assert.AreEqual(565, test2.Numeric); Assert.AreEqual(-1.25, test2.Float); Assert.AreEqual(126, test2.Real); Assert.AreEqual(-65.65m, test2.Money); Assert.AreEqual(23.545m, test2.SmallMoney); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("FloatingPointNumbers")); }
public void DeleteRandomValues() { int count = DataUtil.CountRows("Integers"); ObjectTransaction transaction1 = manager.BeginTransaction(); IntegerTestObject test1 = transaction1.Create(typeof(IntegerTestObject)) as IntegerTestObject; test1.Boolean = false; test1.TinyInt = 1; test1.Int = 123; test1.SmallInt = 56; test1.BigInt = 169; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("Integers")); ObjectTransaction transaction2 = manager.BeginTransaction(); IntegerTestObject test2 = transaction2.Select(typeof(IntegerTestObject), test1.Id) as IntegerTestObject; Assert.AreEqual(false, test2.Boolean); Assert.AreEqual(1, test2.TinyInt); Assert.AreEqual(123, test2.Int); Assert.AreEqual(56, test2.SmallInt); Assert.AreEqual(169, test2.BigInt); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("Integers")); }
public void Delete() { int count = DataUtil.CountRows("DefinedKeys"); ObjectTransaction transaction1 = manager.BeginTransaction(); DefinedKeyTestObject test1 = transaction1.Create(typeof(DefinedKeyTestObject), "defined10") as DefinedKeyTestObject; Assert.AreEqual("defined10", test1.Id); test1.ObjData = 101; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("DefinedKeys")); ObjectTransaction transaction2 = manager.BeginTransaction(); DefinedKeyTestObject test2 = transaction2.Select(typeof(DefinedKeyTestObject), "defined10") as DefinedKeyTestObject; Assert.AreEqual("defined10", test2.Id); Assert.AreEqual(101, test2.ObjData); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("DefinedKeys")); }
public void DeleteRandomValues() { int count = DataUtil.CountRows("NullableIntegers"); ObjectTransaction transaction1 = manager.BeginTransaction(); NullableIntegerTestObject test1 = transaction1.Create(typeof(NullableIntegerTestObject)) as NullableIntegerTestObject; test1.Boolean = true; test1.TinyInt = 5; test1.Int = 12457; test1.SmallInt = 124; test1.BigInt = 1234567; transaction1.Commit(); Assert.AreEqual(count + 1, DataUtil.CountRows("NullableIntegers")); ObjectTransaction transaction2 = manager.BeginTransaction(); NullableIntegerTestObject test2 = transaction2.Select(typeof(NullableIntegerTestObject), test1.Id) as NullableIntegerTestObject; Assert.AreEqual(true, test2.Boolean); Assert.AreEqual(5, test2.TinyInt); Assert.AreEqual(124, test2.SmallInt); Assert.AreEqual(12457, test1.Int); Assert.AreEqual(1234567, test2.BigInt); transaction2.Delete(test2); transaction2.Commit(); Assert.AreEqual(count, DataUtil.CountRows("NullableIntegers")); }
public void DeleteParentWithoutCascade() { ObjectTransaction transaction = manager.BeginTransaction(); DefinedParentTestObject parent = transaction.Select(typeof(DefinedParentTestObject), "Key1") as DefinedParentTestObject; transaction.Delete(parent); }
public void DeleteParentWithoutCascade() { ObjectTransaction transaction = manager.BeginTransaction(); IdentityParentTestObject parent = transaction.Select(typeof(IdentityParentTestObject), 3) as IdentityParentTestObject; transaction.Delete(parent); }
public void DeleteParentWithoutCascade() { ObjectTransaction transaction = manager.BeginTransaction(); GuidParentTestObject parent = transaction.Select(typeof(GuidParentTestObject), "{C9ECFD97-F8BF-4075-A654-C62F6BD750D9}") as GuidParentTestObject; transaction.Delete(parent); }
public void DeleteParent() { int parentCount = DataUtil.CountRows("GuidParents"); int childrenCount = DataUtil.CountRows("GuidChildren"); ObjectTransaction transaction = manager.BeginTransaction(); CascadeGuidParentTestObject parent = transaction.Select(typeof(CascadeGuidParentTestObject), "{C9ECFD97-F8BF-4075-A654-C62F6BD750D9}") as CascadeGuidParentTestObject; foreach (CascadeGuidChildTestObject child in parent.ChildObjects) { transaction.Delete(child); } transaction.Delete(parent); transaction.Commit(); Assert.AreEqual(parentCount - 1, DataUtil.CountRows("GuidParents")); Assert.AreEqual(childrenCount - 2, DataUtil.CountRows("GuidChildren")); }
public void DeleteParent() { int parentCount = DataUtil.CountRows("DefinedParents"); int childrenCount = DataUtil.CountRows("DefinedChildren"); ObjectTransaction transaction = manager.BeginTransaction(); DefinedParentTestObject parent = transaction.Select(typeof(DefinedParentTestObject), "Key1") as DefinedParentTestObject; foreach (DefinedChildTestObject child in parent.ChildObjects) { transaction.Delete(child); } transaction.Delete(parent); transaction.Commit(); Assert.AreEqual(parentCount - 1, DataUtil.CountRows("DefinedParents")); Assert.AreEqual(childrenCount - 2, DataUtil.CountRows("DefinedChildren")); }
public void DeleteParent() { int parentCount = DataUtil.CountRows("IdentityParents"); int childrenCount = DataUtil.CountRows("IdentityChildren"); ObjectTransaction transaction = manager.BeginTransaction(); CascadeIdentityParentTestObject parent = transaction.Select(typeof(CascadeIdentityParentTestObject), 3) as CascadeIdentityParentTestObject; foreach (CascadeIdentityChildTestObject child in parent.ChildObjects) { transaction.Delete(child); } transaction.Delete(parent); transaction.Commit(); Assert.AreEqual(parentCount - 1, DataUtil.CountRows("IdentityParents")); Assert.AreEqual(childrenCount - 2, DataUtil.CountRows("IdentityChildren")); }
public void DeleteParentWithChild() { int count = DataUtil.CountRows("NullParents"); ObjectTransaction transaction = manager.BeginTransaction(); NullParentTestObject obj = transaction.Select(typeof(NullParentTestObject), 1) as NullParentTestObject; Assert.AreEqual(1, obj.Id); Assert.AreEqual(1, obj.Value); Assert.AreEqual(2, obj.ChildObjects.Count); transaction.Delete(obj); Assert.AreEqual(count, DataUtil.CountRows("NullParents")); }
public void DeleteParentWithCascade() { int parentCount = DataUtil.CountRows("NullGuidParents"); int childrenCount = DataUtil.CountRows("NullGuidChildren"); ObjectTransaction transaction = manager.BeginTransaction(); NullGuidParentTestObject parent = transaction.Select(typeof(NullGuidParentTestObject), "{C9ECFD97-F8BF-4075-A654-C62F6BD750D9}") as NullGuidParentTestObject; transaction.Delete(parent); transaction.Commit(); Assert.AreEqual(parentCount - 1, DataUtil.CountRows("NullGuidParents")); Assert.AreEqual(childrenCount, DataUtil.CountRows("NullGuidChildren")); }
public void DeleteParentWithoutCascade() { int parentCount = DataUtil.CountRows("NullDefinedParents"); int childrenCount = DataUtil.CountRows("NullDefinedChildren"); ObjectTransaction transaction = manager.BeginTransaction(); NullDefinedParentTestObject parent = transaction.Select(typeof(NullDefinedParentTestObject), "Key1") as NullDefinedParentTestObject; transaction.Delete(parent); transaction.Commit(); Assert.AreEqual(parentCount - 1, DataUtil.CountRows("NullDefinedParents")); Assert.AreEqual(childrenCount, DataUtil.CountRows("NullDefinedChildren")); }
public void DeleteCircularReference() { int pA = DataUtil.CountRows("ParentA"); int pB = DataUtil.CountRows("ParentB"); int cA = DataUtil.CountRows("ChildA"); ObjectTransaction transaction = manager.BeginTransaction(); ParentBTestObject parentB = transaction.Select(typeof(ParentBTestObject), 40) as ParentBTestObject; transaction.Delete(parentB); transaction.Commit(); Assert.AreEqual(pA - 1, DataUtil.CountRows("ParentA")); Assert.AreEqual(pB - 1, DataUtil.CountRows("ParentB")); Assert.AreEqual(cA - 1, DataUtil.CountRows("ChildA")); }