Beispiel #1
0
        public async Task GetByAccountId_ReturnTransactionViewModelTestAsync()
        {
            var transactions = TransactionMock.TransactionModelFaker.Generate(3);

            _accountRepositoryMock.Setup(x => x.GetTransactionsByAccountId(transactions.FirstOrDefault().AccountId))
            .ReturnsAsync(transactions);

            _mapperMock.Setup(x =>
                              x.Map <IEnumerable <TransactionViewModel> >(It.IsAny <IEnumerable <Transaction> >()))
            .Returns(TransactionMock.TransactionViewModelModelFaker.Generate(3));

            var accountAppService = new AccountAppService(_accountRepositoryMock.Object,
                                                          _mapperMock.Object, _transactionServiceMock.Object, _domainNotificationMock.Object);

            var accountMethod = await accountAppService.GetByAccountId(transactions.FirstOrDefault().AccountId);

            var accountResult = Assert.IsAssignableFrom <IEnumerable <TransactionViewModel> >(accountMethod);

            Assert.NotNull(accountResult);
            Assert.NotEmpty(accountResult);
        }