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