public async Task Should_Success_Read_Data() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(new RealizationVbNonPOServiceHelper()); serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper()); var service = new RealizationVbNonPOService(dbContext, serviceProviderMock.Object); var dataUtil = new RealizationVBNonPODataUtil(service); await dataUtil.GetCreatedData(); var dataRequestVb = dataUtil.GetDataRequestVB(); dbContext.VbRequests.Add(dataRequestVb); dbContext.SaveChanges(); var result = service.Read(1, 10, "{}", new List <string>(), "", "{}"); Assert.NotEmpty(result.Data); }
public async Task Should_Success_Read_Data() { //Arrange var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var IVBRealizationDocumentExpeditionServiceMock = new Mock <IVBRealizationDocumentExpeditionService>(); serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(IVBRealizationDocumentExpeditionServiceMock.Object); serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper()); var service = new RealizationVbNonPOService(dbContext, serviceProviderMock.Object); var dataUtil = new RealizationVBNonPODataUtil(service); await dataUtil.GetTestData(); //Act var result = service.Read(1, 10, "{}", new List <string>(), "", "{}"); //Assert Assert.NotEmpty(result.Data); }