Ejemplo n.º 1
0
        // happy path
        // NOT INTUITIVE: glitch on server side, HTTP response code for success is 500 (Internal Server Error)
        public async Task WhenListExists_Deletes()
        {
            // Arrange
            string name        = "New list to delete";
            string description = "delete test";
            string language    = "en";

            var createListResult = await _client.CreateList(_settings.SessionId, name, description, language);

            var createResponse = JsonConvert.DeserializeObject <ListCrudResponseModel>(createListResult?.Json);

            int?id = createResponse?.ListId;

            _output.WriteLine($"{nameof(_client.CreateList)}({name}, .., ..) called");
            _output.WriteLine($"TMDB server responded: {createListResult.HttpStatusCode}");
            _output.WriteLine($"with id: {id}");

            // Act
            var deleteResult = await _client.DeleteList(_settings.SessionId, id.Value);

            _output.WriteLine($"Calling {nameof(_client.DeleteList)}({id})");
            _output.WriteLine($"TMDB server responded: {deleteResult.HttpStatusCode}");

            // Assert
            Assert.True(deleteResult.HttpStatusCode == System.Net.HttpStatusCode.InternalServerError);
        }
Ejemplo n.º 2
0
        // Setup: create a temporary list for the tests
        public async Task InitializeAsync()
        {
            var createListResult = await _client.CreateList(sessionId : _settings.SessionId, name : "Test list X", description : ""); // 2020.10.10 for some reason API is picky when accepting description parameter

            _output.WriteLine($"{nameof(InitializeAsync)}: {nameof(_client.CreateList)} returned {createListResult.HttpStatusCode}");
            _listId = JsonConvert.DeserializeObject <ListCrudResponseModel>(createListResult.Json).ListId;
            _output.WriteLine($"{nameof(InitializeAsync)}: list created with id {_listId}");
        }
Ejemplo n.º 3
0
        // Setup: create a temporary list with movies for the tests
        public async Task InitializeAsync()
        {
            var createListResult = await _client.CreateList(sessionId : _settings.SessionId, name : "Test list1 with movies", description : "");

            _output.WriteLine($"{nameof(InitializeAsync)}: {nameof(_client.CreateList)}() returned {createListResult.HttpStatusCode}");
            _listId = JsonConvert.DeserializeObject <ListCrudResponseModel>(createListResult.Json).ListId;
            _output.WriteLine($"{nameof(InitializeAsync)}: list created with id {_listId}");

            foreach (var mediaId in _validMovieIds)
            {
                var result = await _client.AddMovie(_settings.SessionId, _listId, mediaId);

                _output.WriteLine($"{nameof(InitializeAsync)}: {nameof(_client.AddMovie)}(list: {_listId}, mediaId: {mediaId}) responded with: {result.HttpStatusCode}");
            }
        }
Ejemplo n.º 4
0
        // happy path
        public async Task WhenArgumentsValid_CreatesNewList()
        {
            // Arrange
            string name        = "New list";
            string description = "test";
            string language    = "en";

            // Act
            var result = await _client.CreateList(_settings.SessionId, name, description, language);

            _output.WriteLine($"TMDB server responded: {result.HttpStatusCode.ToString()}");

            if (result.HttpStatusCode == System.Net.HttpStatusCode.Created)
            {
                _listIdsToDispose.Add(JsonConvert.DeserializeObject <ListCrudResponseModel>(result.Json).ListId);
            }

            // Assert
            Assert.True(result.HttpStatusCode == System.Net.HttpStatusCode.Created);
        }