public async Task GetTotalTransactionAsync() { //Arrange IEnumerable <Transactions> transactions = MockTransactions.GetTransactions(); var mockTransactionsRepository = new Mock <IRepository <Transactions> >(); mockTransactionsRepository.Setup(p => p.GetAsync()).Returns(Task.FromResult(transactions)); IEnumerable <Rates> rates = MockRates.GetRates(); var mockRatesRepository = new Mock <IRepository <Rates> >(); mockRatesRepository.Setup(p => p.GetAsync()).Returns(Task.FromResult(rates)); GraphSolver graphSolver = new GraphSolver(); AmountService amountService = new AmountService(); TransactionBusinessService transactionBusinessService = new TransactionBusinessService(graphSolver, amountService, null); TransactionFilterService transactionFilterService = new TransactionFilterService(null); ConfigurationBuilder configBuilder = new ConfigurationBuilder(); configBuilder.AddInMemoryCollection(new Dictionary <string, string> { { "Currency", "EUR" } }); IConfiguration config = configBuilder.Build(); TransactionsService transactionsService = new TransactionsService(mockTransactionsRepository.Object, mockRatesRepository.Object, transactionFilterService, transactionBusinessService, null, config); //Act var totalTransactionDTO = await transactionsService.GetTotalTransactionAsync("A0000").ConfigureAwait(false); //Assert Assert.NotNull(null); }
public void FilterBySku() { //Arrange TransactionFilterService transactionFilterService = new TransactionFilterService(null); IEnumerable <Transactions> transactions = MockTransactions.GetTransactions(); //Act var transactions_A0000 = transactionFilterService.FilterBySku(transactions, "A0000"); var transactions_B0001 = transactionFilterService.FilterBySku(transactions, "B0001"); var transactions_D0003 = transactionFilterService.FilterBySku(transactions, "D0003"); //Assert Assert.Equal(expected: 2, actual: transactions_A0000.Count()); Assert.Single(transactions_B0001); Assert.Empty(transactions_D0003); }