public void IsPortInUse_With135_ReturnsTrue() { /* This is a really crappy test and only works on Windows environments -- my apologies. */ if (Environment.OSVersion.Platform == PlatformID.Win32NT) { Assert.True(PortAvailability.IsPortBeingUsed(135)); } else { Assert.True(true); } }
public void IsPortInUse_OutsideOfRange_ReturnsTrue() { Assert.True(PortAvailability.IsPortBeingUsed(IPEndPoint.MinPort - 1)); Assert.True(PortAvailability.IsPortBeingUsed(IPEndPoint.MaxPort + 1)); }
public void FindRandomOpenPort_ReturnsPort() { var port = PortAvailability.FindRandomOpenPort(); Assert.NotEqual(-1, port); }
public void FindRandomOpenPort_FindsValidPort() { var port = PortAvailability.FindRandomOpenPort(); Assert.False(IsPortInUse(port)); }
public TcpStumpsServer() { this.ListeningPort = PortAvailability.FindRandomOpenPort(); }