public void TestAttachDetachEntityAdded() { try { using (esTransactionScope scope = new esTransactionScope()) { AggregateTestCollection aggTestColl = new AggregateTestCollection(); AggregateTestCollection aggCloneColl = new AggregateTestCollection(); aggCloneColl.LoadAll(); foreach (AggregateTest entity in aggCloneColl) { if (entity.LastName == "Doe") { entity.MarkAllColumnsAsDirty(esDataRowState.Added); aggTestColl.AttachEntity(aggCloneColl.DetachEntity(entity)); break; } } Assert.IsTrue(aggTestColl.IsDirty); aggTestColl.Save(); Assert.IsFalse(aggTestColl.IsDirty, "Collection is still dirty"); aggTestColl.LoadAll(); Assert.AreEqual(31, aggTestColl.Count); } } finally { UnitTestBase.RefreshDatabase(); } }
public void Init() { //esProviderFactory.Factory = new EntitySpaces.LoaderMT.esDataProviderFactory(); esProviderFactory.Factory = new EntitySpaces.Loader.esDataProviderFactory(); //ProfilerListener.BeginProfiling("EntitySpaces.SqlClientProvider", // ProfilerListener.Channels.Channel_1); esEntity.AddedByEventHandler += new ModifiedByEventHandler(esEntity_AddedByEventHandler); esEntity.ModifiedByEventHandler += new ModifiedByEventHandler(esEntity_ModifiedByHandler); UnitTestBase.RefreshDatabase(); UnitTestBase.RefreshForeignKeyTest(); }
public void CollectionLoadAllFalse() { AggregateTestCollection testColl = new AggregateTestCollection(); try { testColl.LoadAll(); testColl.MarkAllAsDeleted(); testColl.Save(); testColl = new AggregateTestCollection(); Assert.IsFalse(testColl.LoadAll()); } finally { UnitTestBase.RefreshDatabase(); } }