Ejemplo n.º 1
0
        public void DashboardInfoApiTest_GetDashboardSearchResultsPagination_Success()
        {
            // Arrange
            int lid = 589547;
            MockDashboardInfoRepository repository = new MockDashboardInfoRepository();
            IDashboardInfoRepository    mockRepo   = Substitute.For <IDashboardInfoRepository>();
            IDashboardInfoApi           api        = Substitute.For <IDashboardInfoApi>();

            var appSettings = new Settings()
            {
                MaxNumberOfRecordsToReturn = maxRecordsToReturn
            };
            IOptions <Settings> options = Options.Create(appSettings);

            var expectedResult = repository.GetMockMerchantData().Result;

            mockRepo.GetDashboardSearchResultsPagination(Wp.CIS.LynkSystems.Model.Helper.LIDTypes.MerchantNbr, lid, maxRecordsToReturn).ReturnsForAnyArgs(expectedResult);

            api = new DashboardInfoApi(options, mockRepo);

            // Act
            var actualRecord = (api.GetDashboardSearchResultsPagination(Wp.CIS.LynkSystems.Model.Helper.LIDTypes.MerchantNbr, lid).Result).Result;

            // Assert
            Assert.Equal((actualRecord), expectedResult);
            Assert.Equal((actualRecord).MerchInfo.customerID, 393727);
            Assert.Equal((actualRecord).CustProfile.customerID, 393727);
            Assert.Equal((actualRecord).TermInfo, null);
        }
Ejemplo n.º 2
0
        public async Task <ApiResult <DashboardInfo> > GetDashboardSearchResultsPagination(Helper.LIDTypes LIDtype, int LID)
        {
            ApiResult <DashboardInfo> response = new ApiResult <DashboardInfo>();

            try
            {
                response.Result = await _dashboardRepository.GetDashboardSearchResultsPagination(LIDtype, LID, this._optionsAccessor.Value.MaxNumberOfRecordsToReturn);
            }
            catch (System.Exception)
            {
                throw;
            }
            return(response);
        }
Ejemplo n.º 3
0
        public async Task DashboardInfoApiTest_GetDashboardSearchResultsPagination_Exception()
        {
            // Arrange
            int CustomerID  = 191809;
            var appSettings = new Settings()
            {
                MaxNumberOfRecordsToReturn = maxRecordsToReturn
            };
            IOptions <Settings> optionsAccessor = Options.Create(appSettings);

            IDashboardInfoRepository mockRepo         = Substitute.For <IDashboardInfoRepository>();
            IDashboardInfoApi        dashboardInfoApi = Substitute.For <IDashboardInfoApi>();


            mockRepo.GetDashboardSearchResultsPagination(Wp.CIS.LynkSystems.Model.Helper.LIDTypes.CustomerID, CustomerID, maxRecordsToReturn).ThrowsForAnyArgs(new Exception());
            dashboardInfoApi = new DashboardInfoApi(optionsAccessor, mockRepo);


            // Assert
            await Assert.ThrowsAsync <Exception>(() => dashboardInfoApi.GetDashboardSearchResultsPagination(Wp.CIS.LynkSystems.Model.Helper.LIDTypes.CustomerID, CustomerID));
        }