コード例 #1
0
        // happy path
        public async Task WhenCalledOnValidRatedMovie_ReturnsState()
        {
            bool    isFavorite  = false;
            bool    onWatchlist = false;
            decimal rating      = 9m;

            await _client.RateMovie(_settings.SessionId, rating, _movie);

            // Server side (TMDB WebAPI) needs this delay to propagate changes...
            await Task.Delay(2000);

            GetMovieDetailsWithAccountStatesResult response = await _client.GetMovieDetailsWithAccountStates(_settings.SessionId, id : _movie, retryCount : 0);

            _output.WriteLine($"TMDB server's response code {response.HttpStatusCode}");
            _output.WriteLine($"TMDB server's response message {response.Json}");

            AccountMovieStates states = response.ExtractAccountStates();

            PrintAccountMovieStates(states);

            Assert.True(response.HttpStatusCode == System.Net.HttpStatusCode.OK);
            Assert.True(states.IsFavorite == isFavorite);
            Assert.True(states.Rating.Value == rating);
            Assert.True(states.OnWatchlist == onWatchlist);
        }
コード例 #2
0
        // wierd path
        public async Task WhenCalledWithInvalidMovieId_Returns_404NotFound()
        {
            GetMovieDetailsWithAccountStatesResult response = await _client.GetMovieDetailsWithAccountStates(_settings.SessionId, id : _invalidMovie, retryCount : 0);

            _output.WriteLine($"TMDB server's response code {response.HttpStatusCode}");
            Assert.True(response.HttpStatusCode == System.Net.HttpStatusCode.NotFound);
            Assert.Null(response.ExtractAccountStates());
        }
コード例 #3
0
        // wierd path
        public async Task WhenCalledWithInvalidSessionId_ReturnsMovieDetailsAnd_200OK()
        {
            _settings.SessionId = "invalidSessionId";

            GetMovieDetailsWithAccountStatesResult response = await _client.GetMovieDetailsWithAccountStates(_settings.SessionId, id : _movie, retryCount : 0);

            _output.WriteLine($"TMDB server's response code {response.HttpStatusCode}");

            Assert.True(response.HttpStatusCode == System.Net.HttpStatusCode.OK);
            Assert.Null(response.ExtractAccountStates());
            _output.WriteLine($"Imdb id = {JsonConvert.DeserializeObject<MovieDetailModel>(response.Json).ImdbId}");
        }
コード例 #4
0
        // happy path
        public async Task WhenCalledOnValidMovie_ReturnsState()
        {
            bool isFavorite  = false;
            bool onWatchlist = false;

            GetMovieDetailsWithAccountStatesResult response = await _client.GetMovieDetailsWithAccountStates(_settings.SessionId, id : _movie, retryCount : 0);

            _output.WriteLine($"TMDB server's response code {response.HttpStatusCode}");
            _output.WriteLine($"TMDB server's response message {response.Json}");

            AccountMovieStates states = response.ExtractAccountStates();

            PrintAccountMovieStates(states);

            Assert.True(response.HttpStatusCode == System.Net.HttpStatusCode.OK);
            Assert.True(states.IsFavorite == isFavorite);
            Assert.True(states.Rating == null);
            Assert.True(states.OnWatchlist == onWatchlist);
        }