Esempio n. 1
0
        public virtual void TestRefresh()
        {
            IExtObjectContainer client1 = OpenNewSession();
            IExtObjectContainer client2 = OpenNewSession();

            NonTARefreshTestCase.TAItem item1 = (NonTARefreshTestCase.TAItem)RetrieveInstance
                                                    (client1);
            NonTARefreshTestCase.TAItem item2 = (NonTARefreshTestCase.TAItem)RetrieveInstance
                                                    (client2);
            AssertDescendingRange(10, item1);
            AssertDescendingRange(10, item2);
            item1.Value(100);
            item1.Next().Value(200);
            client1.Store(item1, 2);
            client1.Commit();
            Assert.AreEqual(100, item1.Value());
            Assert.AreEqual(200, item1.Next().Value());
            Assert.AreEqual(10, item2.Value());
            Assert.AreEqual(9, item2.Next().Value());
            //refresh 0
            client2.Refresh(item2, 0);
            Assert.AreEqual(10, item2.Value());
            Assert.AreEqual(9, item2.Next().Value());
            //refresh 1
            client2.Refresh(item2, 1);
            Assert.AreEqual(100, item2.Value());
            Assert.AreEqual(9, item2.Next().Value());
            //refresh 2
            client2.Refresh(item2, 2);
            Assert.AreEqual(100, item2.Value());
            Assert.AreEqual(200, item2.Next().Value());
            UpdateAscendingWithRange(item1, 1000);
            client1.Store(item1, 5);
            client1.Commit();
            client2.Refresh(item2, 5);
            NonTARefreshTestCase.TAItem next2 = item2;
            for (int i = 1000; i < 1005; i++)
            {
                Assert.AreEqual(i, next2.Value());
                next2 = next2.Next();
            }
            client1.Close();
            client2.Close();
        }
Esempio n. 2
0
 private void UpdateAscendingWithRange(NonTARefreshTestCase.TAItem item, int startingValue
                                       )
 {
     NonTARefreshTestCase.TAItem current = item;
     while (current != null)
     {
         current.Value(startingValue);
         current = current.Next();
         startingValue++;
     }
 }
Esempio n. 3
0
 private void AssertDescendingRange(int startingValue, NonTARefreshTestCase.TAItem
                                    item)
 {
     NonTARefreshTestCase.TAItem current = item;
     while (current != null)
     {
         Assert.AreEqual(startingValue, current.Value());
         current = current.Next();
         startingValue--;
     }
 }