public async Task Movie_Null() { var httpClient = HttpClientMockFactory.CreateClient(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(nullProperties)) }); var search = new SearchApi("", httpClient); var result = await search.MovieAsync("avengers"); result.ShouldNotBeNull(); result.Results.ShouldNotBeNull(); result.Results.Count.ShouldBe(nullProperties.Results.Length); for (var index = 0; index < result.Results.Count; index++) { var movie = result.Results[index]; var expectedMovie = SearchResultItemFactory.Create <Movie>( nullProperties.Results[index]); movie.ShouldBe(expectedMovie); } }
public async Task TvShow() { var httpClient = HttpClientMockFactory.CreateClient(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(allTvShowProperties)) }); var search = new SearchApi("", httpClient); var result = await search.TvShowAsync("Game of thrones"); result.ShouldNotBeNull(); result.Results.ShouldNotBeNull(); result.Results.Count.ShouldBe(allTvShowProperties.Results.Length); for (var index = 0; index < result.Results.Count; index++) { var tvShow = result.Results[index]; var expectedTvShow = MediaFactory.Create <TvShow>( allTvShowProperties.Results[index]); tvShow.ShouldBe(expectedTvShow); } }
public async Task MultiSearch() { var httpClient = HttpClientMockFactory.CreateClient(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(allMultiSearchProperties)) }); var search = new SearchApi("", httpClient); var result = await search.MultiSearchAsync("Bradley"); result.ShouldNotBeNull(); result.Results.ShouldNotBeNull(); var expected = SearchResultItemFactory.Create(allMultiSearchProperties.Results); var actual = result.Results; actual.ShouldBe(expected); }
public async Task People() { var httpClient = HttpClientMockFactory.CreateClient(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(allPeopleProperties)) }); var search = new SearchApi("", httpClient); var result = await search.PeopleAsync("Bradley"); result.ShouldNotBeNull(); result.Results.ShouldNotBeNull(); result.Results.Count.ShouldBe(allPeopleProperties.Results.Length); for (var index = 0; index < result.Results.Count; index++) { var people = result.Results[index]; var expectedPeople = SearchResultItemFactory.Create <People>(allPeopleProperties.Results[index]); people.ShouldBe(expectedPeople); } }