public static IsPortBeingUsed ( int localPort ) : bool | ||
localPort | int | The local port. |
return | bool |
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.IsTrue(NetworkInformation.IsPortBeingUsed(135)); } else { Assert.IsTrue(true); } }
public void IsPortInUse_OutsideOfRange_ReturnsTrue() { Assert.IsTrue(NetworkInformation.IsPortBeingUsed(IPEndPoint.MinPort - 1)); Assert.IsTrue(NetworkInformation.IsPortBeingUsed(IPEndPoint.MaxPort + 1)); }