예제 #1
0
        public void GetCityIntegrationTest()
        {
            var sut    = new CityAPI();
            var result = sut.GetCity(10618, "test").Result;

            Assert.IsNotNull(result);
        }
예제 #2
0
        public void GetCityTest()
        {
            Fixture fixture = new Fixture();
            var     item    = fixture.Create <City>();

            mockRestService.Setup(x => x.Get <City>(It.IsAny <string>(), null)).Returns(Task.FromResult(item));
            var service = new CityAPI(mockRestService.Object);
            var result  = service.GetCity(4124, "test").Result;

            Assert.AreEqual(item, result);
            mockRestService.Verify(x => x.Get <City>(It.Is <string>(y => y == "/city/id=4124&key=test"), null));
        }