public void Correctly_returns_error_message_from_load_balance_manager_when_no_exception_occurs()
        {
            MockRepository            mocks   = new MockRepository();
            ILoadBalanceStatusManager manager = mocks.CreateMock <ILoadBalanceStatusManager>();
            ILoadBalancerView         view    = mocks.CreateMock <ILoadBalancerView>();

            using (mocks.Record())
            {
                Expect.Call(manager.HandleLoadBalanceRequest()).Return("My error message");
                view.Render("My error message");
            }

            using (mocks.Playback())
            {
                IExceptionHandlingLoadBalanceStatusManager statusManager = new ExceptionHandlingLoadBalanceStatusManager(manager, view, null);
                statusManager.HandleLoadBalancing();
            }
        }
        public void Correctly_swallows_exception_from_action_and_returns_error_message()
        {
            MockRepository            mocks   = new MockRepository();
            ILoadBalanceStatusManager manager = mocks.CreateMock <ILoadBalanceStatusManager>();
            ILoadBalancerView         view    = mocks.CreateMock <ILoadBalancerView>();
            IWebContext context = mocks.CreateMock <IWebContext>();

            Exception exception = mocks.PartialMock <Exception>();

            using (mocks.Record())
            {
                SetupResult.For(exception.ToString()).Return("My exception message");
                Expect.Call(manager.HandleLoadBalanceRequest()).Throw(exception);
                context.WriteToResponse("My exception message");
            }

            using (mocks.Playback())
            {
                IExceptionHandlingLoadBalanceStatusManager statusManager = new ExceptionHandlingLoadBalanceStatusManager(manager, view, context);
                statusManager.HandleLoadBalancing();
            }
        }