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 string IPv6Network_ToString() => _networkV6.ToString();
public string NetworkToString() => _net1.ToString();