public void BasicTest(string test, string expectedNetwork, string expectedEnd, byte expectedMask, string expectedSubnetSize) { IpAddressNetworkV6 net = IpAddressNetworkV6.Parse(test); net.Mask.Should().Be(expectedMask); net.NetworkAddress.Should().Be((IpAddressV6)expectedNetwork); net.EndAddress.Should().Be((IpAddressV6)expectedEnd); BigInteger bigExpectedSubnetSize = BigInteger.Parse(expectedSubnetSize); net.SubnetSize.Should().Be(bigExpectedSubnetSize); }
public void FullPropertyTest() { IpAddressNetworkV6 net = IpAddressNetworkV6.Parse("2001:db8::8a2e:371:7334/96"); net.Mask.Should().Be(96); net.ToString().Should().Be("2001:db8::8a2e:0:0/96"); net.NetworkAddress.Should().Be((IpAddressV6)"2001:db8::8a2e:0:0"); net.EndAddress.Should().Be((IpAddressV6)"2001:db8::8a2e:ffff:ffff"); net.NetworkMask.Should().Be((IpAddressV6)"ffff:ffff:ffff:ffff:ffff:ffff::"); net.NetworkWildcardMask.Should().Be((IpAddressV6)"::ffff:ffff"); net.SubnetSize.Should().Be(4294967296); }
public void ValidIPv4InV6FormatTests(string expected, string test, byte cidr) { string expectedWithoutSlash = expected.Split('/').First(); IpAddressNetworkV6 parsed = IpAddressNetworkV6.Parse(test); IPAddress expectedIp = IPAddress.Parse(expectedWithoutSlash); parsed.NetworkAddress.Should().Be(expectedIp); if (cidr == 128) { parsed.EndAddress.Should().Be(expectedIp); } parsed.Mask.Should().Be(cidr); // This representation is special, and should still be the IPv4 in IPv6 mapped expectedIp.ToString().Should().Be(expectedWithoutSlash); parsed.ToString().Should().Be(expected); }
public IpAddressNetworkV6 CurrentIPv6Parser() { return(IpAddressNetworkV6.Parse("2001:0dff:44ff:0:1744::ffff/64")); }