/// <exception cref="System.Exception"></exception>
        public virtual void TestChangedAfterCommit()
        {
            Item item = ItemByName("Foo");

            item.SetName("Bar");
            AssertUpdatedObjects(item);
            item.SetName("Foo");
            AssertUpdatedObjects(item);
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestTransparentUpdate()
        {
            Item foo = ItemByName("Foo");
            Item bar = ItemByName("Bar");

            Assert.AreEqual("Bar", bar.GetName());
            // accessed but not changed
            foo.SetName("Bar");
            // changing more than once shouldn't be a problem
            foo.SetName("Foo*");
            AssertUpdatedObjects(foo);
            Reopen();
            Assert.IsNotNull(ItemByName("Foo*"));
            Assert.IsNull(ItemByName("Foo"));
            Assert.IsNotNull(ItemByName("Bar"));
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestConcurrentClientModification()
        {
            if (!IsMultiSession())
            {
                return;
            }
            IExtObjectContainer client1 = Db();
            IExtObjectContainer client2 = OpenNewSession();

            try
            {
                Item foo1 = ItemByName(client1, "Foo");
                Item foo2 = ItemByName(client2, "Foo");
                foo1.SetName("Foo*");
                foo2.SetName("Foo**");
                AssertUpdatedObjects(client1, foo1);
                AssertUpdatedObjects(client2, foo2);
                client1.Refresh(foo1, 1);
                Assert.AreEqual(foo2.GetName(), foo1.GetName());
            }
            finally
            {
                client2.Close();
            }
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestActivateOnWrite()
        {
            Item foo = ItemByName("Foo");

            foo.SetName("Foo*");
            Assert.AreEqual("Foo*", foo.GetName());
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestUpdateAfterActivation()
        {
            Item foo = ItemByName("Foo");

            Assert.AreEqual("Foo", foo.GetName());
            foo.SetName("Foo*");
            AssertUpdatedObjects(foo);
        }
示例#6
0
        public virtual void Test()
        {
            Item tbd = InsertAndRetrieve();

            tbd.SetName("foo.deleted");
            Db().Delete(tbd);
            Db().Rollback();
            Assert.AreEqual("foo.tbd", tbd.GetName());
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestObjectGoneAfterUpdateAndDeletion()
        {
            Item foo = ItemByName("Foo");

            foo.SetName("Foo*");
            Db().Delete(foo);
            Reopen();
            Assert.IsNull(ItemByName("Foo"));
            Assert.IsNull(ItemByName("Foo*"));
        }
        public virtual void TestUpdate()
        {
            Item found = SodaQueryForItem("42");

            Assert.AreEqual("42", found.GetName());
            Assert.AreSame(found, NativeQueryForItem("42"));
            found.SetName("21");
            Assert.AreSame(found, SodaQueryForItem("21"));
            Assert.AreSame(found, NativeQueryForItem("21"));
            Assert.IsNull(SodaQueryForItem("42"));
            Db().Commit();
            Assert.AreSame(found, NativeQueryForItem("21"));
        }
 private void Change(Item item)
 {
     item.SetName(item.GetName() + "*");
 }
		private void Change(Item item)
		{
			item.SetName(item.GetName() + "*");
		}