//Would be revisiting to modify the actual way of call method.
        public void TerminalDetailsInfoTest_TerminalSuccess()
        {
            // Arrange
            int lid = 191809;

            MockTerminalDetailsInfoRepository repository = new MockTerminalDetailsInfoRepository();
            var expectedResult = repository.GetMockTerminalDetails();
            IOptions <DataContext>     optionsAccessor   = Substitute.For <IOptions <DataContext> >();
            IDatabaseConnectionFactory connectionFactory = Substitute.For <IDatabaseConnectionFactory>();
            ITerminalDetailsRepository mockRepo          = Substitute.For <ITerminalDetailsRepository>();

            mockRepo.GetTerminalDetails(lid).ReturnsForAnyArgs(expectedResult.Result);

            // Act
            var actualRecord = mockRepo.GetTerminalDetails(lid).Result;

            // Assert

            Assert.Equal(actualRecord, expectedResult.Result);
        }
示例#2
0
        public ApiResult <EAndPData> GetTerminalDetails(int termNbr)
        {
            ApiResult <EAndPData> response = new ApiResult <EAndPData>();

            try
            {
                var result = _terminalDetailsRepository.GetTerminalDetails(termNbr);
                response.Result = result.Result;
            }
            catch (System.Exception)
            {
                throw;
            }
            return(response);
        }
示例#3
0
        public void TerminalDetailsInfoApiTest_TerminalDetailsException()
        {
            // Arrange
            int CustomerID = 191809;

            IOptions <Settings>        optionsAccessor  = Substitute.For <IOptions <Settings> >();
            ITerminalDetailsRepository mockRepo         = Substitute.For <ITerminalDetailsRepository>();
            ITerminalDetailsApi        dashboardInfoApi = Substitute.For <ITerminalDetailsApi>();

            mockRepo.GetTerminalDetails(CustomerID).ThrowsForAnyArgs(new Exception());
            dashboardInfoApi = new TerminalDetailsApi(optionsAccessor, mockRepo, null);


            // Assert
            Assert.Throws <Exception>(() => dashboardInfoApi.GetTerminalDetails(CustomerID));
        }
示例#4
0
        public void TerminalDetailsInfoApiTest_TerminalDetailsSuccess()
        {
            // Arrange
            int lid = 589547;
            MockTerminalDetailsInfoRepository repository = new MockTerminalDetailsInfoRepository();

            ITerminalDetailsRepository mockRepo = Substitute.For <ITerminalDetailsRepository>();
            ITerminalDetailsSettlementInfoRepository mockSettlementRepo = Substitute.For <ITerminalDetailsSettlementInfoRepository>();
            ITerminalDetailsApi api         = Substitute.For <ITerminalDetailsApi>();
            IOptions <Settings> appSettings = Substitute.For <IOptions <Settings> >();

            var expectedResult           = repository.GetMockTerminalDetails().Result;
            var expectedSettlementResult = repository.GetMockTerminalSettlementInfo().Result;

            mockRepo.GetTerminalDetails(lid).ReturnsForAnyArgs(expectedResult);
            mockSettlementRepo.GetTerminalSettlementInfo(lid).ReturnsForAnyArgs(expectedSettlementResult);
            api = new TerminalDetailsApi(appSettings, mockRepo, mockSettlementRepo);

            // Act
            var actualRecord = (api.GetTerminalDetails(lid).Result);

            // Assert
            Assert.Equal((actualRecord), expectedResult);
        }