public void Test_Requirement_1_BaseAndDerivedTypes() { using (UnitOfWork uow = new UnitOfWork()) { BasePersistentClass obj1 = new BasePersistentClass(uow); obj1.UniqueAgainstObjectTypeInBaseClass = "same non-unique value is allowed for records of different types"; //other obj1 properties are initialized with NULL values by default. DerivedPersistentClass obj2 = new DerivedPersistentClass(uow); obj2.UniqueAgainstObjectTypeInBaseClass = "same non-unique value is allowed for records of different types"; obj2.UniqueAgainstGCRecordInBaseClass = "unique"; uow.CommitChanges(); } }
public void Test_Requirement_1_DerivedTypes() { using (UnitOfWork uow = new UnitOfWork()) { DerivedPersistentClass obj1 = new DerivedPersistentClass(uow); obj1.UniqueAgainstObjectTypeInDerivedClass = "non-unique"; //other obj1 properties are initialized with NULL values by default. DerivedPersistentClass obj2 = new DerivedPersistentClass(uow); obj2.UniqueAgainstObjectTypeInBaseClass = "unique"; obj2.UniqueAgainstObjectTypeInDerivedClass = "non-unique"; obj2.UniqueAgainstGCRecordInBaseClass = "unique"; obj2.UniqueAgainstGCRecordInDerivedClass = "unique"; uow.CommitChanges(); } }
public void Test_Requirement_2_BaseAndDerivedTypes() { using (UnitOfWork uow = new UnitOfWork()) { BasePersistentClass obj1 = new BasePersistentClass(uow); obj1.UniqueAgainstGCRecordInBaseClass = "same value is allowed, because deleted records are not taken into account"; //other obj1 properties are initialized with NULL values by default. uow.CommitChanges(); uow.Delete(obj1); uow.CommitChanges(); DerivedPersistentClass obj2 = new DerivedPersistentClass(uow); obj2.UniqueAgainstGCRecordInBaseClass = "same value is allowed, because deleted records are not taken into account"; obj2.UniqueAgainstObjectTypeInBaseClass = "unique"; uow.CommitChanges(); } }