Skip to content

Commit

Permalink
Added logging to integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
DAQEM committed Nov 6, 2023
1 parent 3d1e994 commit c924d25
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
using System.Net.Http.Json;
using System.Net;
using System.Net.Http.Json;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
using Xunit.Abstractions;

namespace Netmon.SNMPPolling.IntegrationTests;

public class SNMPDiscoverIntegrationTests : IClassFixture<WebApplicationFactory<SNMPPollingProgram>>
{
private readonly WebApplicationFactory<SNMPPollingProgram> _factory;
private readonly ITestOutputHelper _testOutputHelper;

public SNMPDiscoverIntegrationTests(WebApplicationFactory<SNMPPollingProgram> factory)
public SNMPDiscoverIntegrationTests(WebApplicationFactory<SNMPPollingProgram> factory, ITestOutputHelper testOutputHelper)
{
_factory = factory;
_testOutputHelper = testOutputHelper;
}

[Theory]
Expand All @@ -30,7 +34,9 @@ public async Task Get_EndpointsReturnSuccessAndCorrectContentType(string url)
});

// Assert
response.EnsureSuccessStatusCode();
_testOutputHelper.WriteLine("Status code: {0}", response.StatusCode);
_testOutputHelper.WriteLine("Response: {0}", await response.Content.ReadAsStringAsync());
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("application/json; charset=utf-8", response.Content.Headers.ContentType?.ToString());
}
}

0 comments on commit c924d25

Please sign in to comment.