public async Task TransactionHistoryApiTest_GetAnException()
        {
            // Arrange
            string terminalId      = "LK429486";
            string transactionType = "Credit";
            MockTransactionHistoryRepository mockTransactionHistoryRepository          = new MockTransactionHistoryRepository();
            ApiResult <GenericPaginationResponse <TransactionHistory> > expectedResult = mockTransactionHistoryRepository.GetMockData(transactionType);
            PaginationTransactionHistory page = mockTransactionHistoryRepository.GetPagination();

            IOptions <Settings>           optionsAccessor = Substitute.For <IOptions <Settings> >();
            ITransactionHistoryRepository mockRepo        = Substitute.For <ITransactionHistoryRepository>();

            IDistributedCache      mockCache       = Substitute.For <IDistributedCache>();
            ILoggingFacade         loggingFacade   = Substitute.For <ILoggingFacade>();
            ITransactionHistoryApi terminalListApi = Substitute.For <ITransactionHistoryApi>();

            terminalListApi.WhenForAnyArgs(x => x.GetTransactionHistoryAsync(Arg.Any <string>(), Arg.Any <PaginationTransactionHistory>())).DoNotCallBase();
            mockRepo.GetTransactionHistoryAsync(terminalId, page).Throws(new Exception());

            loggingFacade.WhenForAnyArgs(x => x.LogAsync(Arg.Any <LogLevels>(), Arg.Any <string>(), Arg.Any <CancellationToken>())).DoNotCallBase();

            terminalListApi = new TransactionHistoryApi(optionsAccessor, mockRepo, loggingFacade);


            // Assert

            await Assert.ThrowsAsync <Exception>(() => terminalListApi.GetTransactionHistoryAsync(terminalId, page));
        }
        public void TransactionHistoryApiTest_Success()
        {
            // Arrange

            string terminalId      = "LK429486";
            string transactionType = "Credit";
            MockTransactionHistoryRepository mockTransactionHistoryRepository          = new MockTransactionHistoryRepository();
            ApiResult <GenericPaginationResponse <TransactionHistory> > expectedResult = mockTransactionHistoryRepository.GetMockData(transactionType);
            PaginationTransactionHistory page = mockTransactionHistoryRepository.GetPagination();

            IOptions <Settings> optionsAccessor = Substitute.For <IOptions <Settings> >();

            ITransactionHistoryRepository mockRepo = Substitute.For <ITransactionHistoryRepository>();
            ILoggingFacade loggingFacade           = Substitute.For <ILoggingFacade>();

            ITransactionHistoryApi mockTransactionHistoryApi = Substitute.For <ITransactionHistoryApi>();

            mockTransactionHistoryApi.WhenForAnyArgs(x => x.GetTransactionHistoryAsync(Arg.Any <string>(), Arg.Any <PaginationTransactionHistory>())).DoNotCallBase();
            mockRepo.GetTransactionHistoryAsync(terminalId, page).ReturnsForAnyArgs(expectedResult.Result);

            loggingFacade.WhenForAnyArgs(x => x.LogAsync(Arg.Any <LogLevels>(), Arg.Any <string>(), Arg.Any <CancellationToken>())).DoNotCallBase();

            mockTransactionHistoryApi = new TransactionHistoryApi(optionsAccessor, mockRepo, loggingFacade);

            // Act
            var    terminalList = mockTransactionHistoryApi.GetTransactionHistoryAsync(terminalId, page).Result;
            var    actualRecord = (IList <Wp.CIS.LynkSystems.Model.TransactionHistory>)terminalList.Result.ReturnedRecords;
            string merchInfo    = actualRecord.Where(x => x.REQ_TRAN_TYPE == transactionType).FirstOrDefault().REQ_AMT;


            //// Assert

            Assert.Equal(((IList <TransactionHistory>)actualRecord).Count, 1);

            Assert.Equal(merchInfo, "589587");
        }