Ejemplo n.º 1
0
        public void Present()
        {
            Id <TestObject>          id;
            TestObject               o;
            UndoMgr                  undomgr  = new UndoMgr(5);
            ObjectStore <TestObject> objstore = new ObjectStore <TestObject>(undomgr);

            undomgr.BeginCommand(57, "Command1");

            o  = new TestObject(5, "hello", 5.4F);
            id = objstore.Add(o);
            Assert.AreEqual(1, id.id);

            Assert.IsTrue(objstore.IsPresent(new Id <TestObject>(1)));
            Assert.IsFalse(objstore.IsPresent(new Id <TestObject>(2)));

            objstore.CheckPresent(new Id <TestObject>(1));
            try {
                objstore.IsPresent(new Id <TestObject>(2));
                Assert.Fail("should throw");
            }
            catch { }
        }
Ejemplo n.º 2
0
        public void Present()
        {
            Id<TestObject> id;
            TestObject o;
            UndoMgr undomgr = new UndoMgr(5);
            ObjectStore<TestObject> objstore = new ObjectStore<TestObject>(undomgr);

            undomgr.BeginCommand(57, "Command1");

            o = new TestObject(5, "hello", 5.4F);
            id = objstore.Add(o);
            Assert.AreEqual(1, id.id);

            Assert.IsTrue(objstore.IsPresent(new Id<TestObject>(1)));
            Assert.IsFalse(objstore.IsPresent(new Id<TestObject>(2)));

            objstore.CheckPresent(new Id<TestObject>(1));
            try {
                objstore.IsPresent(new Id<TestObject>(2));
                Assert.Fail("should throw");
            }
            catch { }
        }