Skip to content

Commit

Permalink
use #if for both unit tests and include new helper method inside
Browse files Browse the repository at this point in the history
  • Loading branch information
cocoon authored Sep 6, 2024
1 parent 45ad87c commit 4a076b5
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/WireMock.Net.Tests/WireMockServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ public WireMockServerTests(ITestOutputHelper testOutputHelper)
{
_testOutputHelper = testOutputHelper;
}

private static string[] GetIPAddressesByFamily(AddressFamily addressFamily)
{
return NetworkInterface.GetAllNetworkInterfaces()
.Where(ni => ni.OperationalStatus == OperationalStatus.Up)
.SelectMany(ni => ni.GetIPProperties().UnicastAddresses)
.Where(addr => addr.Address.AddressFamily == addressFamily)
.Select(addr => addr.Address.ToString())
.ToArray();
}

[Fact]
public void WireMockServer_Start()
Expand Down Expand Up @@ -210,6 +200,16 @@ public async Task WireMockServer_When_HttpClientWithWebProxyCallsHttp_Should_Wor
#endif

#if NET6_0_OR_GREATER
private static string[] GetIPAddressesByFamily(AddressFamily addressFamily)
{
return NetworkInterface.GetAllNetworkInterfaces()
.Where(ni => ni.OperationalStatus == OperationalStatus.Up)
.SelectMany(ni => ni.GetIPProperties().UnicastAddresses)
.Where(addr => addr.Address.AddressFamily == addressFamily)
.Select(addr => addr.Address.ToString())
.ToArray();
}

[IgnoreOnContinuousIntegrationFact]
public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv4()
{
Expand All @@ -235,9 +235,7 @@ public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv4()

server.Stop();
}
#endif

#if NET6_0_OR_GREATER
[IgnoreOnContinuousIntegrationFact]
public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv6()
{
Expand Down

0 comments on commit 4a076b5

Please sign in to comment.