Beispiel #1
0
        public void GetShowEpisode_MockWebApi_ShowId_Season_EpisodeNumber_Episode()
        {
            // Arrange
            const int showId        = 1;
            const int season        = 1;
            const int episodeNumber = 1;
            var       json          = File.ReadAllText(Path.Combine(BasePath, DomainObjectFactoryTests.JSON_DATA_PATH, "episode.json"));
            var       mockHttp      = new MockHttpMessageHandler();

            mockHttp.Expect($"{BASE_API_URL}/shows/{showId}/episodebynumber")
            .WithQueryString("season", "1")
            .WithQueryString("number", "1")
            .Respond("application/json", json);

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

            // Act
            var episode = tvMazeClient.GetShowEpisode(showId, season, episodeNumber);

            // Assert
            Assert.IsNotNull(episode);
            Assert.AreEqual(1, episode.Id);
            mockHttp.VerifyNoOutstandingExpectation();
        }