Пример #1
0
 public HttpClientFactoryInstanceManagementService(IHttpClientFactory httpClientFactory,
                                                   IConfiguration configuration, MoviesClient moviesClient)
 {
     _httpClientFactory = httpClientFactory;
     Configuration      = configuration;
     _moviesClient      = moviesClient;
 }
        public void GetMovieAsyncTest(MoviesClient sut)
        {
            //act
            var actual = sut.GetMovieAsync("tt0111161").Result;

            //Assert
            actual.Should().BeOfType <MovieModel>();
        }
        public void GetAllAvailableMoviesAsync_should_be_in_descending_order(MoviesClient sut)
        {
            //act
            var actual = sut.GetAllAvailableMoviesAsync(false).Result.ToList();

            //assert
            actual.Should().BeInDescendingOrder(x => x.Title);
        }
        public async void GetAllAvailableMoviesAsync_should_be_list_of_movie_models(MoviesClient sut)
        {
            //act
            var actual = sut.GetAllAvailableMoviesAsync(true);

            //assert
            actual.Result.ToList().Should().BeOfType <List <MovieModel> >();
        }
        public void GetTop100MoviesAsyncTest_should_be_in_decending_order(MoviesClient sut)
        {
            //act
            var actual = sut.GetTop100MoviesAsync(false).Result.ToList();

            //assert
            actual.Should().BeInDescendingOrder(x => x.Rated);
        }
        public void GetTop100MoviesAsyncTest_should_be_list_of_movie_models(MoviesClient sut)
        {
            //act
            var actual = sut.GetTop100MoviesAsync(true).Result.ToList();

            //assert
            actual.Should().BeOfType <List <MovieModel> >();
        }
Пример #7
0
        private async void WishlistForm_Load(object sender, EventArgs e)
        {
            client = new MoviesClient(new HttpClient(new FakeResponseHandler())
            {
                BaseAddress = new Uri("http://test.com/api/")
            });
            client.OAuthAccessToken = "sadasdasdasdasdasdasd4545345345343asd";
            var wishlist = await client.Movies.Wishlist.Get();

            dataGridView1.DataSource = wishlist.Content;
            FormBorderStyle          = FormBorderStyle.FixedDialog;
        }
Пример #8
0
        public async Task <IList <MoviesGetOKResponseContent> > GetMovies()
        {
            var fakeResponseHandler = new FakeResponseHandler();
            var httpClient          = new HttpClient(fakeResponseHandler)
            {
                BaseAddress = new Uri("http://test.com/api/")
            };

            client = new MoviesClient(httpClient);
            client.SchemaValidation.RaiseExceptions = false;
            var movies = await client.Movies.Get();

            return(movies.Content);
        }
Пример #9
0
        public void Customize(IFixture fixture)
        {
            IConfiguration configRoot = new ConfigurationBuilder()
                                        .AddInMemoryCollection(new Dictionary <string, string>
            {
                { "BugClientUrl", "http://localhost:80/bugsapi/" },
                { "Loggers:0", "1" },
                { "Loggers:1", "2" },
                { "Loggers:2", "3" }
            })
                                        .Build();

            var movie       = fixture.Build <MovieModel>().CreateMany();
            var movieClient = new MoviesClient(configRoot, new HttpClient());


            fixture.Register(() => movie);
            fixture.Register(() => configRoot);
            fixture.Register(() => movieClient);
        }
Пример #10
0
 public HttpClientFactoryInstanceManagementService(IHttpClientFactory httpClientFactory,
                                                   MoviesClient moviesClient)
 {
     _httpClientFactory = httpClientFactory;
     _moviesClient      = moviesClient;
 }