Ejemplo n.º 1
0
        public void InsertTransferCallsControllerAddTransferToBatch()
        {
            MockEFTController        controller = new MockEFTController();
            NewTransferViewPresenter presenter  = new NewTransferViewPresenter(controller);
            MockNewTransferView      view       = new MockNewTransferView();
            Transfer insertedTransfer           = GetNewTransfer();

            presenter.View = view;

            presenter.OnTransferInserted(insertedTransfer);

            Assert.IsTrue(controller.AddTransferToBatchCalled);
            Assert.AreSame(insertedTransfer, controller.TransferAddedToBatch);
        }
Ejemplo n.º 2
0
        public void DeleteTransferCallsControllerRemoveTransferFromBatch()
        {
            MockEFTController        controller = new MockEFTController();
            NewTransferViewPresenter presenter  = new NewTransferViewPresenter(controller);
            MockNewTransferView      view       = new MockNewTransferView();
            Transfer deletedTransfer            = GetNewTransfer();

            presenter.View = view;

            presenter.OnTransferDeleted(deletedTransfer);

            Assert.IsTrue(controller.RemoveTransferFromBatchCalled);
            Assert.AreSame(deletedTransfer, controller.TransferRemovedFromBatch);
        }
Ejemplo n.º 3
0
        public void UpdateTransferCallsControllerUpdateTransferInBatch()
        {
            MockEFTController        controller = new MockEFTController();
            NewTransferViewPresenter presenter  = new NewTransferViewPresenter(controller);
            MockNewTransferView      view       = new MockNewTransferView();

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

            presenter.OnTransferUpdated(updatedTransfer);

            Assert.IsTrue(controller.UpdateTransferInBatchCalled);
            Assert.AreSame(updatedTransfer, controller.TransferUpdatedInBatch);
        }
        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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        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);
        }
        public void UpdateTransferCallsControllerUpdateTransferInBatch()
        {
            MockEFTController controller = new MockEFTController();
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView view = new MockNewTransferView();
            presenter.View = view;
            Transfer updatedTransfer = GetNewTransfer();

            presenter.OnTransferUpdated(updatedTransfer);

            Assert.IsTrue(controller.UpdateTransferInBatchCalled);
            Assert.AreSame(updatedTransfer, controller.TransferUpdatedInBatch);
        }
        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);
        }
        public void InsertTransferCallsControllerAddTransferToBatch()
        {
            MockEFTController controller = new MockEFTController();
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView view = new MockNewTransferView();
            Transfer insertedTransfer = GetNewTransfer();
            presenter.View = view;

            presenter.OnTransferInserted(insertedTransfer);

            Assert.IsTrue(controller.AddTransferToBatchCalled);
            Assert.AreSame(insertedTransfer, controller.TransferAddedToBatch);
        }
        public void DeleteTransferCallsControllerRemoveTransferFromBatch()
        {
            MockEFTController controller = new MockEFTController();
            NewTransferViewPresenter presenter = new NewTransferViewPresenter(controller);
            MockNewTransferView view = new MockNewTransferView();
            Transfer deletedTransfer = GetNewTransfer();
            presenter.View = view;

            presenter.OnTransferDeleted(deletedTransfer);

            Assert.IsTrue(controller.RemoveTransferFromBatchCalled);
            Assert.AreSame(deletedTransfer, controller.TransferRemovedFromBatch);
        }