public async Task GetFarmSamplesListAsyn_NullService() { var mockService = new Mock <IAgreementService>(); mockService.Setup(w => w.GetFarmSampleListAsync(string.Empty, string.Empty, string.Empty)).Returns(Task.FromResult((FarmSample[])null)); var service = mockService.Object; var repo = new AgreementRepository(service, null); var result = await repo.GetFarmSamplesListAsync(supplier, string.Empty); Assert.AreEqual(0, result.Length); }
public async Task GetFarmSamplesListAsyn_LiveService() { var mockService = new Mock <IAgreementService>(); var expectedPriceHeding = new FarmSample[1] { new FarmSample { } }; mockService.Setup(w => w.GetFarmSampleListAsync(supplier, string.Empty, ticket)).Returns(Task.FromResult(expectedPriceHeding)); var service = mockService.Object; var repo = new AgreementRepository(service, null); var result = await repo.GetFarmSamplesListAsync(supplier, string.Empty); Assert.AreEqual(1, result.Length); }