public void Given_When_Build_Should_Build_CustomerAccountViewModel()
        {
            //arrange
            var transaction = new Transaction
            {
                Id     = 1,
                Amount = 50
            };

            var accountTransactionResponse = new AccountTransactionResponse
            {
                Transactions = new List <Transaction>
                {
                    transaction
                }
            };

            var transactionRequest = new TransactionRequest(1);

            _transactionRequestBuilderMock.Setup(c => c.Build(1)).Returns(transactionRequest);

            _transactionProviderMock.Setup(c => c.Execute(transactionRequest)).Returns(accountTransactionResponse);

            //act
            var expectedAccountTransactionViewModel = _transactionViewModelBuilder.Build(1);

            //assert
            var expectedAccountTransaction = expectedAccountTransactionViewModel.Transactions.FirstOrDefault();

            Assert.NotNull(expectedAccountTransactionViewModel);
            Assert.AreEqual(expectedAccountTransactionViewModel.Transactions.Count(), 1);
            Assert.AreEqual(expectedAccountTransaction.Id, transaction.Id);
            Assert.AreEqual(expectedAccountTransaction.Amount, transaction.Amount);
        }
Ejemplo n.º 2
0
        public ActionResult Index(int accountId)
        {
            var accountTransactions = _transactionViewModelBuilder.Build(accountId);

            return(View(accountTransactions));
        }