예제 #1
0
        public async Task GetAnalyzeListAsyncTest_NullService()
        {
            var mockService = new Mock <IWeighInService>();

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

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

            Assert.AreEqual(0, list.Length);
        }
예제 #2
0
        public async Task GetAnalyzeListAsyncTest_LiveService()
        {
            var expected = new AnalyzeList[1] {
                new AnalyzeList {
                }
            };

            var mockService = new Mock <IWeighInService>();

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

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

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