public async Task Delete_delete_campaign_and_response_not_content_status_code() { using (var server = CreateServer()) { var fakeCampaignDto = GetFakeCampaignDto(); var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json"); //add campaign var campaignResponse = await server.CreateClient() .PostAsync(Post.AddNewCampaign, content); if (int.TryParse(campaignResponse.Headers.Location.Segments[4], out int id)) { var response = await server.CreateClient() .DeleteAsync(Delete.CampaignBy(id)); Assert.True(response.StatusCode == HttpStatusCode.NoContent); } campaignResponse.EnsureSuccessStatusCode(); } }