// 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); }
public async Task DisposeAsync() { foreach (int id in _listIdsToDispose) { await _client.DeleteList(_settings.SessionId, id); } }
// Teardown: remove the list created by the Setup code public async Task DisposeAsync() { var result = await _client.DeleteList(_settings.SessionId, _listId); // The TMDB WebAPI has some glitch with the CreateList response code: Http.500 == Success !! _output.WriteLine($"{nameof(DisposeAsync)}: {nameof(_client.DeleteList)}({_listId}) returned {(result.HttpStatusCode == System.Net.HttpStatusCode.InternalServerError ? "Success" : "some failure...")}"); }