Esempio n. 1
0
        public void DeleteTest()
        {
            string rmName = "DeleteTest" + Guid.NewGuid();

            MyRM.MyRM_Accessor rm      = MockRM(rmName);
            Transaction        context = new Transaction();
            Customer           c       = new Customer();
            RID rid   = new RID(RID.Type.ROOM, "test1");
            int count = 5;
            int price = 3;

            Assert.IsFalse(rm.Delete(context, rid));
            rm.Add(context, rid, count, price);
            rm.Delete(context, rid, 2);
            Assert.AreEqual(3, rm.Query(context, rid));
            rm.Reserve(context, c, rid);
            rm.Delete(context, rid);
            Assert.AreEqual(0, rm.QueryReservedPrice(context, c));
            Assert.IsTrue(string.IsNullOrEmpty(rm.QueryReserved(context, c)));
            rm.Query(context, rid);
            Assert.Fail("shall not hit this line.");
        }
Esempio n. 2
0
        public void UnReserveTest()
        {
            MyRM.MyRM_Accessor rm      = MockRM("UnReserveTest");
            Transaction        context = new Transaction();
            Customer           c       = new Customer();
            RID rid   = new RID(RID.Type.ROOM, "test1");
            RID rid1  = new RID(RID.Type.CAR, "test1");
            int count = 5;
            int price = 3;

            Assert.IsFalse(rm.Delete(context, rid));
            rm.Add(context, rid, count, price);
            rm.Add(context, rid1, count, price);
            rm.Reserve(context, c, rid);
            Assert.AreEqual(count, rm.Query(context, rid1));
            Assert.AreEqual(count - 1, rm.Query(context, rid));
            rm.UnReserve(context, c);
            Assert.AreEqual(count, rm.Query(context, rid1));
            Assert.AreEqual(count, rm.Query(context, rid));
        }