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

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

            var repo = new GrobarhetRepository(service);
            var list = await repo.GetGrobarhetAsync("", "");

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

            var mockService = new Mock <IGrobarhetService>();

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

            var repo   = new GrobarhetRepository(service);
            var actual = await repo.GetGrobarhetAsync("", "");

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