public void Can_by_coffee_from_starbucks()
        {
            baristaLoadBalancer.Start();
            Console.WriteLine("Barista load balancer has started");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            barista.Start();

            Console.WriteLine("Barista has started");

            customerHost.Start<CustomerBootStrapper>();

            var bus = (IServiceBus)customerHost.Bus;

            var userInterface = new MockCustomerUserInterface();
            var customer = new CustomerController(bus)
            {
                CustomerUserInterface = userInterface,
                Drink = "Hot Chocolate",
                Name = "Ayende",
                Size = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Assert.Equal("Ayende", userInterface.CoffeeRushName);
        }
        public void Can_by_coffee_from_starbucks()
        {
            baristaLoadBalancer.Start();
            Console.WriteLine("Barista load balancer has started");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            barista.Start();

            Console.WriteLine("Barista has started");

            customerHost.Start <CustomerBootStrapper>();

            var bus = (IServiceBus)customerHost.Bus;

            var userInterface = new MockCustomerUserInterface();
            var customer      = new CustomerController(bus)
            {
                CustomerUserInterface = userInterface,
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Assert.Equal("Ayende", userInterface.CoffeeRushName);
        }
        public void Can_by_coffee_from_starbucks()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            var baristaLoadBalancer = new RemoteAppDomainLoadBalancerHost(typeof(RemoteAppDomainHost).Assembly, "LoadBalancer.config");

            baristaLoadBalancer.Start();

            Console.WriteLine("Barista load balancer has started");

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                          .Configuration("Cashier.config");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                          .Configuration("Barista.config");

            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();

            customerHost.Start <CustomerBootStrapper>();

            var bus = customerHost.Container.Resolve <IServiceBus>();

            var userInterface = new MockCustomerUserInterface();
            var customer      = new CustomerController(bus)
            {
                CustomerUserInterface = userInterface,
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            cashier.Close();
            barista.Close();

            Assert.Equal("Ayende", userInterface.CoffeeRushName);
        }
        public void Can_by_coffee_from_starbucks()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            var baristaLoadBalancer = new RemoteAppDomainLoadBalancerHost(typeof (RemoteAppDomainHost).Assembly, "LoadBalancer.config");
            baristaLoadBalancer.Start();

            Console.WriteLine("Barista load balancer has started");

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                .Configuration("Cashier.config");
            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                .Configuration("Barista.config");
            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();
            customerHost.Start<CustomerBootStrapper>();

            var bus = customerHost.Container.Resolve<IServiceBus>();

            var userInterface = new MockCustomerUserInterface();
            var customer = new CustomerController(bus)
            {
                CustomerUserInterface = userInterface,
                Drink = "Hot Chocolate",
                Name = "Ayende",
                Size = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            cashier.Close();
            barista.Close();

            Assert.Equal("Ayende", userInterface.CoffeeRushName);
        }