//Would be revisiting to modify the actual way of call method. public void TerminalDetailsSettlementTest_TerminalSuccess() { // Arrange int lid = 191809; MockTerminalDetailsInfoRepository repository = new MockTerminalDetailsInfoRepository(); var expectedResult = repository.GetMockTerminalSettlementInfo(); IOptions <DataContext> optionsAccessor = Substitute.For <IOptions <DataContext> >(); IDatabaseConnectionFactory connectionFactory = Substitute.For <IDatabaseConnectionFactory>(); ITerminalDetailsSettlementInfoRepository mockRepo = Substitute.For <ITerminalDetailsSettlementInfoRepository>(); mockRepo.GetTerminalSettlementInfo(lid).ReturnsForAnyArgs(expectedResult.Result); // Act var actualRecord = mockRepo.GetTerminalSettlementInfo(lid).Result; // Assert Assert.Equal(actualRecord, expectedResult.Result); }
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); }