Esempio n. 1
0
        public async Task ShowSingleSearchAsync_MockWebApi_SearchQuery_Show()
        {
            // Arrange
            const string query    = "under the dome";
            var          json     = File.ReadAllText(Path.Combine(BasePath, DomainObjectFactoryTests.JSON_DATA_PATH, "show.json"));
            var          mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect($"{BASE_API_URL}/singlesearch/shows")
            .Respond("application/json", json);

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

            // Act
            var show = await tvMazeClient.ShowSingleSearchAsync(query);

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