static void Main(string[] args)
        {
            Client client = new Client();
            string azureSBConnection = System.Configuration.ConfigurationManager.AppSettings["AzureConnection"];

            using (IBus bus = client.StartAzureEndpoint(azureSBConnection, true, false))
            //using (IBus bus = client.StartSQLEndpoint())
            {
                Console.WriteLine("Press enter to publish a message");
                Console.WriteLine("Press any key to exit");
                while (true)
                {
                    Console.WriteLine();
                    ConsoleKeyInfo key = Console.ReadKey();
                    Console.WriteLine();
                    if (key.Key != ConsoleKey.Enter)
                    {
                        return;
                    }
                    string orderId = Client.GetRandomOrderId();

                    client.SubmitOrder(orderId, bus);
                    //client.SubmitOrder_TransportException(orderId, bus);
                    //client.SubmitOrder_DataException(orderId, bus);
                    //client.SubmitOrder_SagaTransportException(orderId, bus);
                    //client.SubmitOrder_SagaTimeoutException(orderId, bus);
                }

            }
        }
        public async Task DisabledTx_AzureTransaction_RollsbackBusinessDataButNotSagaDataOnDataException()
        {
            //Arrange
            Client client = new Client();
            string orderId = Client.GetRandomOrderId();

            using (IBus bus = client.StartAzureEndpoint(_azureSBConnection, false, true))
            {
                //Act
                client.SubmitOrder_DataException(orderId, bus);
            }

            // Assert
            await Helpers.PutTaskDelay();

            Helpers.Assert_Failed_OrderTransactionCommitted(orderId);
            Helpers.Assert_SagaDataTransactionCommitted_InSharedDB(orderId);
            //Assert.AreEqual("", SharedState.HandleSuccessMessage);           
        }
        public async Task DisabledTx_AzureTransport_Successfully_CreateDatabaseRecords()
        {
            //Arrange
            Client client = new Client();
            string orderId = Client.GetRandomOrderId();

            using (IBus bus = client.StartAzureEndpoint(_azureSBConnection, false, true))
            {
                //Act
                client.SubmitOrder(orderId, bus);
            }

            // Assert
            await Helpers.PutTaskDelay();

            Helpers.Assert_OrderTransactionCommitted(orderId);
            Helpers.Assert_SagaDataTransactionCommitted_InSharedDB(orderId);           
            //Assert.AreEqual(string.Format("Order {0} accepted.", orderId), SharedState.HandleSuccessMessage);
        }
        public async Task Outbox_SQLSagaTransport_RollsbackSagaAndDataOnTransportException()
        {
            //Arrange
            Client client = new Client();
            string orderId = Client.GetRandomOrderId();

            using (IBus bus = client.StartSQLEndpoint(true))
            {
                //Act
                client.SubmitOrder_SagaTransportException(orderId, bus);
            }

            // Assert
            await Helpers.PutTaskDelay();

            Helpers.Assert_Failed_OrderTransactionCommitted(orderId);
            Helpers.Assert_Failed_SagaDataTransactionCommitted_InSharedDB(orderId);
            //Assert.AreEqual("", SharedState.HandleSuccessMessage);           
        }
        public async Task Outbox_AzureSagaTransport_RollsbackSagaAndDataOnTransportException()
        {
            //Arrange
            Client client = new Client();
            string orderId = Client.GetRandomOrderId();

            using (IBus bus = client.StartAzureEndpoint(_azureSBConnection, true, false))
            {
                //Act
                client.SubmitOrder_SagaTransportException(orderId, bus);
            }

            // Assert
            await Helpers.PutTaskDelay();

            Helpers.Assert_Failed_OrderTransactionCommitted(orderId);
            Helpers.Assert_Failed_SagaDataTransactionCommitted_InBusinessDB(orderId);
            Helpers.Assert_OutboxWasNotUsedOrWasRolledBack_InBusinessDB();
            //Assert.AreEqual("", SharedState.HandleSuccessMessage);           
        }