public async Task CategoryDeleteOperationsTest() { var unauthorizedResponse = await DefaultClient.DeleteAsync($"api/Categories/{Guid.NewGuid()}"); Assert.Equal(HttpStatusCode.Unauthorized, unauthorizedResponse.StatusCode); var notExistingResponse = await AuthorizedClient.DeleteAsync($"api/Categories/{Guid.NewGuid()}"); Assert.Equal(HttpStatusCode.NoContent, notExistingResponse.StatusCode); var badResponse = await AuthorizedClient.DeleteAsync($"api/Categories/{Guid.Empty}"); Assert.Equal(HttpStatusCode.BadRequest, badResponse.StatusCode); var category = new Models.Category() { Name = "IsDeletePossible" }; category = await categoryRepository.Create(category); var response = await AuthorizedClient.DeleteAsync($"api/Categories/{category.Id}"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); }
public async Task IsDeleteOperationWorksCorrectly() { var unauthResponse = await DefaultClient.DeleteAsync($"api/Users/{sampleUser.Id}"); Assert.Equal(HttpStatusCode.Unauthorized, unauthResponse.StatusCode); var badResponse = await AuthorizedClient.DeleteAsync($"api/Users/{Guid.Empty}"); Assert.Equal(HttpStatusCode.BadRequest, badResponse.StatusCode); var noContentResponse = await AuthorizedClient.DeleteAsync($"api/Users/{Guid.NewGuid()}"); Assert.Equal(HttpStatusCode.NoContent, noContentResponse.StatusCode); var response = await AuthorizedClient.DeleteAsync($"api/Users/{sampleUser.Id}"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); }