public async Task GetWeighInListAsyncTest_NullService() { var mockService = new Mock <IWeighInService>(); mockService.Setup(w => w.GetWeighInListAsync("", 0, "")).Returns(Task.FromResult((WeighIn[])null)); var service = mockService.Object; var repo = new WeighInRepository(service); var list = await repo.GetWeighInListAsync("", 0, ""); Assert.AreEqual(0, list.Length); }
public async Task GetWeighInListAsyncTest_LiveService() { var expected = new WeighIn[1] { new WeighIn { } }; var mockService = new Mock <IWeighInService>(); mockService.Setup(w => w.GetWeighInListAsync("", 0, "")).Returns(Task.FromResult(expected)); var service = mockService.Object; var repo = new WeighInRepository(service); var actual = await repo.GetWeighInListAsync("", 0, ""); Assert.AreEqual(expected.Length, actual.Length); Assert.AreEqual(expected[0], actual[0]); }