public void OnApproveCustomerCallsControllerApproveCurrentCustomer()
        {
            MockCustomersController controller = new MockCustomersController();
            ApproveCustomerViewPresenter presenter = new ApproveCustomerViewPresenter(controller);
            MockApproveCustomerView view = new MockApproveCustomerView();
            presenter.View = view;

            presenter.OnApproveCustomer();

            Assert.IsTrue(controller.ApproveCurrentCustomerCalled);
        }
        public void OnApproveCustomerCallsControllerApproveCurrentCustomer()
        {
            MockCustomersController      controller = new MockCustomersController();
            ApproveCustomerViewPresenter presenter  = new ApproveCustomerViewPresenter(controller);
            MockApproveCustomerView      view       = new MockApproveCustomerView();

            presenter.View = view;

            presenter.OnApproveCustomer();

            Assert.IsTrue(controller.ApproveCurrentCustomerCalled);
        }
        public void OnViewLoadedCallsControllerCurrentCustomerAndViewSetCustomer()
        {
            MockCustomersController controller = new MockCustomersController();
            Customer customer = controller.InnerCurrentCustomer = new Customer();
            ApproveCustomerViewPresenter presenter = new ApproveCustomerViewPresenter(controller);
            MockApproveCustomerView view = new MockApproveCustomerView();
            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.CurrentCustomerRetrieved);
            Assert.IsTrue(view.CustomerSet);
            Assert.AreSame(customer, view.Customer);
        }
        public void OnViewLoadedCallsControllerCurrentCustomerAndViewSetCustomer()
        {
            MockCustomersController controller = new MockCustomersController();
            Customer customer = controller.InnerCurrentCustomer = new Customer();
            ApproveCustomerViewPresenter presenter = new ApproveCustomerViewPresenter(controller);
            MockApproveCustomerView      view      = new MockApproveCustomerView();

            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.CurrentCustomerRetrieved);
            Assert.IsTrue(view.CustomerSet);
            Assert.AreSame(customer, view.Customer);
        }
        public void OnViewLoadedDisablesShowingAndApprovingCustomerIfControllerCurrentCustomerIsNull()
        {
            MockCustomersController controller = new MockCustomersController();

            controller.InnerCurrentCustomer = null;
            ApproveCustomerViewPresenter presenter = new ApproveCustomerViewPresenter(controller);
            MockApproveCustomerView      view      = new MockApproveCustomerView();

            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.CurrentCustomerRetrieved);
            Assert.IsNull(view.Customer);
            Assert.IsFalse(view.AllowApproveCustomer);
            Assert.IsFalse(view.ShowCustomerDetails);
        }
        public void OnViewLoadedDisablesShowingAndApprovingCustomerIfControllerCurrentCustomerIsNull()
        {
            MockCustomersController controller = new MockCustomersController();
            controller.InnerCurrentCustomer = null;
            ApproveCustomerViewPresenter presenter = new ApproveCustomerViewPresenter(controller);
            MockApproveCustomerView view = new MockApproveCustomerView();
            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.CurrentCustomerRetrieved);
            Assert.IsNull(view.Customer);
            Assert.IsFalse(view.AllowApproveCustomer);
            Assert.IsFalse(view.ShowCustomerDetails);
        }