Esempio n. 1
0
        public async Task GetShowEpisodesAsync_MockWebApi_ShowId_AirDate_EpisodeListByAirDate()
        {
            // Arrange
            const int showId   = 1;
            var       json     = File.ReadAllText(Path.Combine(BasePath, DomainObjectFactoryTests.JSON_DATA_PATH, "episodes.json"));
            var       mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect($"{BASE_API_URL}/shows/{showId}/episodesbydate")
            .WithQueryString("date", "2013-07-01")
            .Respond("application/json", json);

            var tvMazeClient = new TvMazeClient(BASE_API_URL, mockHttp.ToHttpClient());

            // Act
            var episodeList = await tvMazeClient.GetShowEpisodesAsync(showId, new DateTime(2013, 7, 1));

            // Assert
            Assert.IsNotNull(episodeList);
            Assert.IsNotEmpty(episodeList);
            mockHttp.VerifyNoOutstandingExpectation();
        }