public void ShouldThrowExceptionIfCantFindTransaction() { // Arrange var transactionTableRepository = Substitute.For <ITableRepository <TransactionHistory> >(); TransactionHistoryService transactionService = new TransactionHistoryService(transactionTableRepository); transactionTableRepository.ContainsByPK(1).Returns(false); // Act var transaction = transactionService.GetTransactionByID(1); }
public void ShouldGetTransactionInfo() { // Arrange var transactionTableRepository = Substitute.For <ITableRepository <TransactionHistory> >(); TransactionHistoryService transactionService = new TransactionHistoryService(transactionTableRepository); transactionTableRepository.ContainsByPK(1).Returns(true); // Act var transaction = transactionService.GetTransactionByID(1); // Assert transactionTableRepository.Received(1).FindByPK(1); }