public void DeleteSeatsTest() { var wc = new MyWC.MyWC_Accessor(); var tm = new MyTM.MyTM(); var rm = new MyRM.MyRM(); MyWC_Accessor.TransactionManager = tm; rm.SetName("flight_000"); rm.TransactionManager = tm; tm.Register(rm); MyWC.MyWC.Flights = tm.GetResourceMananger("flight_000"); var context = wc.Start(); var flights = wc.ListFlights(context); foreach (var f in flights) { wc.DeleteFlight(context, f.Split(',')[0]); } wc.Commit(context); context = wc.Start(); Assert.IsTrue(wc.AddSeats(context, "FLX", 100, 550)); Assert.IsTrue(wc.AddSeats(context, "SGX", 200, 250)); wc.Commit(context); context = wc.Start(); var result = wc.ListFlights(context); wc.Commit(context); Assert.AreEqual(2, result.Length); context = wc.Start(); Assert.IsTrue(wc.DeleteSeats(context, "FLX", 50)); Assert.IsTrue(wc.DeleteSeats(context, "SGX", 50)); wc.Commit(context); context = wc.Start(); var c1 = wc.QueryFlight(context, "FLX"); var c2 = wc.QueryFlight(context, "SGX"); Assert.AreEqual(100 - 50, c1); Assert.AreEqual(200 - 50, c2); wc.Abort(context); }
public void DeleteSeatsTest() { var wc = new MyWC.MyWC_Accessor(); var tm = new MyTM.MyTM(); var rm = new MyRM.MyRM(); MyWC_Accessor.TransactionManager = tm; rm.SetName("flight_000"); rm.TransactionManager = tm; tm.Register(rm); MyWC.MyWC.Flights = tm.GetResourceMananger("flight_000"); var context = wc.Start(); var flights = wc.ListFlights(context); foreach(var f in flights) { wc.DeleteFlight(context, f.Split(',')[0]); } wc.Commit(context); context = wc.Start(); Assert.IsTrue(wc.AddSeats(context, "FLX", 100, 550)); Assert.IsTrue(wc.AddSeats(context, "SGX", 200, 250)); wc.Commit(context); context = wc.Start(); var result = wc.ListFlights(context); wc.Commit(context); Assert.AreEqual(2, result.Length); context = wc.Start(); Assert.IsTrue(wc.DeleteSeats(context, "FLX", 50)); Assert.IsTrue(wc.DeleteSeats(context, "SGX", 50)); wc.Commit(context); context = wc.Start(); var c1 = wc.QueryFlight(context, "FLX"); var c2 = wc.QueryFlight(context, "SGX"); Assert.AreEqual(100 - 50, c1); Assert.AreEqual(200 - 50, c2); wc.Abort(context); }