예제 #1
0
        public void CancelSingleFlight()
        {
            var wc  = new MyWC.MyWC_Accessor();
            var tm  = new MyTM.MyTM();
            var rmf = new MyRM.MyRM();
            var rmc = new MyRM.MyRM();
            var rmr = new MyRM.MyRM();

            MyWC_Accessor.TransactionManager = tm;

            rmf.SetName("flight");
            rmf.TransactionManager = tm;

            rmc.SetName("car");
            rmc.TransactionManager = tm;

            rmr.SetName("room");
            rmr.TransactionManager = tm;

            tm.Register(rmf);
            tm.Register(rmc);
            tm.Register(rmr);

            MyWC.MyWC.Flights            = tm.GetResourceMananger("flight");
            MyWC.MyWC.Cars               = tm.GetResourceMananger("car");
            MyWC.MyWC.Rooms              = tm.GetResourceMananger("room");
            MyWC.MyWC.TransactionManager = tm;

            var context = new Transaction();

            wc.AddSeats(context, "SEA-JFK", 1000, 200);
            wc.Commit(context);

            var c1 = new Customer();

            Assert.IsTrue(wc.ReserveItinerary(c1, new[] { "SEA-JFK" }, "NY", false, false));

            context = new Transaction();
            Assert.AreEqual(c1, wc.ListCustomers(context)[0]);
            Assert.IsFalse(String.IsNullOrEmpty(wc.QueryItinerary(context, c1)), "Itinerary not found");
            wc.Commit(context);

            context = new Transaction();
            Assert.AreEqual(1000 - 1, wc.QueryFlight(context, "SEA-JFK"));
            wc.Commit(context);

            wc.CancelItinerary(c1);

            context = new Transaction();
            Assert.AreEqual(1000, wc.QueryFlight(context, "SEA-JFK"));
            wc.Commit(context);
        }
예제 #2
0
        public void CancelSingleFlight()
        {
            var wc = new MyWC.MyWC_Accessor();
            var tm = new MyTM.MyTM();
            var rmf = new MyRM.MyRM();
            var rmc = new MyRM.MyRM();
            var rmr = new MyRM.MyRM();
            MyWC_Accessor.TransactionManager = tm;

            rmf.SetName("flight");
            rmf.TransactionManager = tm;

            rmc.SetName("car");
            rmc.TransactionManager = tm;

            rmr.SetName("room");
            rmr.TransactionManager = tm;

            tm.Register(rmf);
            tm.Register(rmc);
            tm.Register(rmr);

            MyWC.MyWC.Flights = tm.GetResourceMananger("flight");
            MyWC.MyWC.Cars = tm.GetResourceMananger("car");
            MyWC.MyWC.Rooms = tm.GetResourceMananger("room");
            MyWC.MyWC.TransactionManager = tm;

            var context = new Transaction();
            wc.AddSeats(context, "SEA-JFK", 1000, 200);
            wc.Commit(context);

            var c1 = new Customer();
            Assert.IsTrue(wc.ReserveItinerary(c1, new[] { "SEA-JFK" }, "NY", false, false));

            context = new Transaction();
            Assert.AreEqual(c1, wc.ListCustomers(context)[0]);
            Assert.IsFalse(String.IsNullOrEmpty(wc.QueryItinerary(context, c1)), "Itinerary not found");
            wc.Commit(context);

            context = new Transaction();
            Assert.AreEqual(1000 - 1, wc.QueryFlight(context, "SEA-JFK"));
            wc.Commit(context);

            wc.CancelItinerary(c1);

            context = new Transaction();
            Assert.AreEqual(1000, wc.QueryFlight(context, "SEA-JFK"));
            wc.Commit(context);
        }