Exemple #1
0
        public void Not_Must_Get_Starship_HttpError()
        {
            httpClientMock.Setup(h => h.Get(string.Empty)).Returns(StarshipHttpResponseStub.NotFound());

            var starshipRepository = new StarshipRepository(httpClientMock.Object, settingsMock.Object);
            var starships          = starshipRepository.GetAllStarshipsAsync().Result;

            Assert.Empty(starships);
        }
Exemple #2
0
        public void Must_Get_3_Starships()
        {
            httpClientMock.Setup(h => h.Get(string.Empty)).Returns(StarshipHttpResponseStub.AllPage1());
            httpClientMock.Setup(h => h.Get("page2")).Returns(StarshipHttpResponseStub.AllPage2());

            var starshipRepository = new StarshipRepository(httpClientMock.Object, settingsMock.Object);
            var starships          = starshipRepository.GetAllStarshipsAsync().Result;

            Assert.Equal(3, starships.Count());
        }