/// <exception cref="System.Exception"></exception> protected override void Store() { MixedTARefreshTestCase.Item item = MixedTARefreshTestCase.TAItem.NewItem(ItemDepth ); item._isRoot = true; Store(item); }
public static MixedTARefreshTestCase.Item NewItem(int depth) { if (depth == 0) { return(null); } MixedTARefreshTestCase.Item header = new MixedTARefreshTestCase.Item(depth); header._next = MixedTARefreshTestCase.TAItem.NewTAITem(depth - 1); return(header); }
public virtual void TestRefresh() { IExtObjectContainer client1 = OpenNewSession(); IExtObjectContainer client2 = OpenNewSession(); MixedTARefreshTestCase.Item item1 = RetrieveInstance(client1); MixedTARefreshTestCase.Item item2 = RetrieveInstance(client2); MixedTARefreshTestCase.Item next1 = item1; int value = 10; while (next1 != null) { Assert.AreEqual(value, next1.GetValue()); next1 = next1.Next(); value--; } MixedTARefreshTestCase.Item next2 = item2; value = 10; while (next2 != null) { Assert.AreEqual(value, next2.GetValue()); next2 = next2.Next(); value--; } item1.SetValue(100); item1.Next().SetValue(200); client1.Store(item1, 2); client1.Commit(); Assert.AreEqual(100, item1.GetValue()); Assert.AreEqual(200, item1.Next().GetValue()); Assert.AreEqual(10, item2.GetValue()); Assert.AreEqual(9, item2.Next().GetValue()); //refresh 0 client2.Refresh(item2, 0); Assert.AreEqual(10, item2.GetValue()); Assert.AreEqual(9, item2.Next().GetValue()); //refresh 1 client2.Refresh(item2, 1); Assert.AreEqual(100, item2.GetValue()); Assert.AreEqual(9, item2.Next().GetValue()); //refresh 2 client2.Refresh(item2, 2); Assert.AreEqual(100, item2.GetValue()); //FIXME: maybe a bug //Assert.areEqual(200, item2.next().getValue()); next1 = item1; value = 1000; while (next1 != null) { next1.SetValue(value); next1 = next1.Next(); value++; } client1.Store(item1, 5); client1.Commit(); client2.Refresh(item2, 5); next2 = item2; for (int i = 1000; i < 1005; i++) { Assert.AreEqual(i, next2.GetValue()); next2 = next2.Next(); } client1.Close(); client2.Close(); }
public static MixedTARefreshTestCase.Item NewItem(int depth) { if (depth == 0) { return null; } MixedTARefreshTestCase.Item header = new MixedTARefreshTestCase.Item(depth); header._next = MixedTARefreshTestCase.TAItem.NewTAITem(depth - 1); return header; }