/// <summary>
        /// All RM prepared, one RM dies before receiving Commit, on recovery, the RM should recover the transaction, WC shouldn’t notice this
        /// </summary>
        public void ReCommitAfterRmFailTransaction2PC()
        {
            StartUp();

            CarsRM.SelfDestruct(0, 0, 1, 0);
            Customer c = new Customer("12345678-1234-1234-1234-123456789012");

            string[] flights = new string[] { "SEA->LAX", "LAX->LAV" };
            ThreadPool.QueueUserWorkItem(o => { Thread.Sleep(1000); CarsRM.SelfDestruct(0, 0, 0, 0); });
            WorkflowControl.ReserveItinerary(c, flights, "Vegas", true, true);
            // We shall see some commit retry message from TM but the transaction shall success.
            Transaction t      = WorkflowControl.Start();
            string      actual = WorkflowControl.QueryItinerary(t, c);

            Console.WriteLine(actual);
            Assert.AreEqual("F:SEA->LAX,F:LAX->LAV,C:Vegas,R:Vegas", actual);
            actual = PrintCars();
            Assert.AreEqual("Vegas,0,3;NewYork,10,30;", actual);
            actual = PrintRooms();
            Assert.AreEqual("Vegas,1,1;NewYork,20,10;", actual);
            actual = PrintFlights();
            Assert.AreEqual("SEA->LAX,9,2;LAX->LAV,11,3;SEA->JFK,8,4;", actual);
            actual = PrintCustomers();
            Assert.AreEqual("12345678-1234-1234-1234-123456789012;", actual);
        }
        /// <summary>
        /// All RMs returns prepared, except one fails to prepare, the transaction should abort
        /// </summary>
        public void RollbackAfterRmFailTransaction2PC()
        {
            StartUp();
            CarsRM.SelfDestruct(0, 1, 0, 0);
            Customer c = new Customer("12345678-1234-1234-1234-123456789012");

            string[] flights = new string[] { "SEA->LAX", "LAX->LAV" };
            WorkflowControl.ReserveItinerary(c, flights, "Vegas", true, true);
            // We shall see some rollback message from TM.
            Console.WriteLine("One RM failed at prepare. TM will rollback all prepared RMs");
            Pause();
            Transaction t      = WorkflowControl.Start();
            string      actual = WorkflowControl.QueryItinerary(t, c);

            Console.WriteLine(actual);
            Assert.AreEqual("", actual);
            actual = PrintCars();
            Assert.AreEqual("Vegas,1,3;NewYork,10,30;", actual);
            actual = PrintRooms();
            Assert.AreEqual("Vegas,2,1;NewYork,20,10;", actual);
            actual = PrintFlights();
            Assert.AreEqual("SEA->LAX,10,2;LAX->LAV,12,3;SEA->JFK,8,4;", actual);
            actual = PrintCustomers();
            Assert.AreEqual("", actual);
        }