예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }