public void IsAuthorizedIpWithIPInBlockAddressReturnsTrue() { this.authorization.AllowIp.Add(IPAddressBlock.Parse("240.0.0.0/4")); bool result = this.authorization.IsAuthorized(IPAddress.Parse("242.1.1.15")); Assert.True(result); }
public void IsAuthorizedIpWithAllZerosIPV6AddressReturnsTrue() { this.authorization.AllowIp.Add(IPAddressBlock.Parse("0:0:0:0:0:0:0:0/0")); bool result = this.authorization.IsAuthorized(IPAddress.Parse("1:2:3:4:5:6:7:8")); Assert.True(result); }
public void IsAuthorizedIpWithAllZerosIPAddressReturnsTrue() { this.authorization.AllowIp.Add(IPAddressBlock.Parse("0.0.0.0/0")); bool result = this.authorization.IsAuthorized(IPAddress.Parse("127.1.1.15")); Assert.True(result); }
public void IsAuthorizedIpV6WithIPNotInBlockAddressReturnsTrue() { this.authorization.AllowIp.Add(IPAddressBlock.Parse("208.0.0.0/4")); bool result = this.authorization.IsAuthorized(IPAddress.Parse("0:0:0:0:0:ffff:f201:010f")); Assert.False(result); }
public void IsAuthorizedIpWithIPNotInV6BlockAddressReturnsTrue() { this.authorization.AllowIp.Add(IPAddressBlock.Parse("0:0:0:0:0:ffff:d000:0/100")); bool result = this.authorization.IsAuthorized(IPAddress.Parse("242.1.1.15")); Assert.False(result); }
public void IsAuthorizedInvalidBlockThrowsError() { Assert.Throws <FormatException>(() => IPAddressBlock.Parse("240.0.0.0/33")); }