public static void ParseAddressFromCidrNotation() { const string input = "192.168.2.0/23"; var result = NetworkUtilities.ParseIPv4Addresses(input); var parsedIps = new List <IPAddress>(); var parsedIp = string.Empty; if (result.Success) { parsedIps = result.Value; } if (parsedIps.Count > 0) { parsedIp = parsedIps[0].ToString(); } Console.WriteLine(result.Success); Console.WriteLine(parsedIps.Count); Console.WriteLine(parsedIp); }
public void ParseAddressFromCidrNotation() { const string input = "192.168.2.0/24"; var result = NetworkUtilities.ParseIPv4Addresses(input); var parsedIps = new List <IPAddress>(); var parsedIp = string.Empty; if (result.Success) { parsedIps = result.Value; } if (parsedIps.Count > 0) { parsedIp = parsedIps[0].ToString(); } Assert.IsTrue(result.Success); Assert.AreEqual(1, parsedIps.Count); Assert.AreEqual("192.168.2.0", parsedIp); }
public void ParseValidString() { const string input = "192.168.2.9"; var result = NetworkUtilities.ParseIPv4Addresses(input); var parsedIps = new List <IPAddress>(); var parsedIp = string.Empty; if (result.Success) { parsedIps = result.Value; } if (parsedIps.Count > 0) { parsedIp = parsedIps[0].ToString(); } //Assert.IsTrue(result.Success); //Assert.AreEqual(1, parsedIps.Count); //Assert.AreEqual(input, parsedIp); }