示例#1
0
        public async Task GetOverViewListAsyncTest_NullService()
        {
            var mockService = new Mock <IWeighInService>();

            mockService.Setup(w => w.GetOverViewListAsync("", 0, "")).Returns(Task.FromResult((Overview[])null));
            var service = mockService.Object;

            var repo = new WeighInRepository(service);
            var list = await repo.GetOverViewListAsync("", 0, "");

            Assert.AreEqual(0, list.Length);
        }
示例#2
0
        public async Task GetOverViewListAsyncTest_LiveService()
        {
            var expected = new Overview[1] {
                new Overview {
                }
            };

            var mockService = new Mock <IWeighInService>();

            mockService.Setup(w => w.GetOverViewListAsync("", 0, "")).Returns(Task.FromResult(expected));
            var service = mockService.Object;

            var repo   = new WeighInRepository(service);
            var actual = await repo.GetOverViewListAsync("", 0, "");

            Assert.AreEqual(expected.Length, actual.Length);
            Assert.AreEqual(expected[0], actual[0]);
        }