protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         _presenter.OnViewInitialized();
     }
     _presenter.OnViewLoaded();
 }
Beispiel #2
0
        public void AddIsEnabledAfterFithItemDeleted()
        {
            MockEFTController        controller = new MockEFTController();
            NewTransferViewPresenter presenter  = new NewTransferViewPresenter(controller);
            MockNewTransferView      view       = new MockNewTransferView();

            presenter.View = view;
            Transfer deletedTransfer = GetNewTransfer();

            Assert.IsTrue(view.EnableAddTransfer);

            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(deletedTransfer);

            presenter.OnViewLoaded();
            Assert.IsFalse(view.EnableAddTransfer);

            presenter.OnTransferDeleted(deletedTransfer);
            presenter.OnViewLoaded();
            Assert.IsTrue(view.EnableAddTransfer);
        }
        public void AddIsDisabledAfterFiveItemsAdded()
        {
            MockEFTController controller = new MockEFTController();
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView view = new MockNewTransferView();
            presenter.View = view;

            Assert.IsTrue(view.EnableAddTransfer);

            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());
            presenter.OnTransferInserted(GetNewTransfer());

            presenter.OnViewLoaded();
            Assert.IsFalse(view.EnableAddTransfer);
        }
Beispiel #4
0
        public void OnViewLoadedCallsControllerGetAccountsAndSetsAccountsInView()
        {
            MockEFTController controller = new MockEFTController();
            Account           account    = new Account();

            controller.Accounts = new Account[] { account };
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView      view      = new MockNewTransferView();

            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.GetAccountsCalled);
            Assert.IsTrue(view.AccountsSet);
            Assert.AreSame(account, view.Accounts[0]);
            Assert.AreEqual(1, view.Accounts.Length);
        }
Beispiel #5
0
        public void OnViewLoadedCallsControllerGetTransfersAndSetsTransfersInView()
        {
            MockEFTController controller = new MockEFTController();
            Transfer          transfer   = GetNewTransfer();

            controller.Transfers = new Transfer[] { transfer };
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView      view      = new MockNewTransferView();

            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.GetTransfersCalled);
            Assert.IsTrue(view.TransfersSet);
            Assert.AreSame(transfer, view.Transfers[0]);
            Assert.AreEqual(1, view.Transfers.Length);
        }
        public void OnViewLoadedCallsControllerGetTransfersAndSetsTransfersInView()
        {
            MockEFTController controller = new MockEFTController();
            Transfer transfer = GetNewTransfer();
            controller.Transfers = new Transfer[] { transfer };
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView view = new MockNewTransferView();
            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.GetTransfersCalled);
            Assert.IsTrue(view.TransfersSet);
            Assert.AreSame(transfer, view.Transfers[0]);
            Assert.AreEqual(1, view.Transfers.Length);
        }
        public void OnViewLoadedCallsControllerGetAccountsAndSetsAccountsInView()
        {
            MockEFTController controller = new MockEFTController();
            Account account = new Account();
            controller.Accounts = new Account[] { account };
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView view = new MockNewTransferView();
            presenter.View = view;

            presenter.OnViewLoaded();

            Assert.IsTrue(controller.GetAccountsCalled);
            Assert.IsTrue(view.AccountsSet);
            Assert.AreSame(account, view.Accounts[0]);
            Assert.AreEqual(1, view.Accounts.Length);
        }