public void Test() { StaticDNS dns = new StaticDNS( MemBlock.Reference(Utils.StringToBytes("10.250.0.0", '.')), MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.'))); Assert.AreEqual(dns.NameLookUp("10.250.1.1"), "C250001001.ipop", "NameLookUp Dns set in range."); Assert.AreEqual(dns.NameLookUp("10.251.1.1"), null, "NameLookUp Dns set out of range."); Assert.AreEqual(dns.AddressLookUp("C250001001.ipop"), "10.250.1.1", "AddressLookUp Dns set."); Assert.AreEqual(dns.AddressLookUp("C250001001.blaha"), null, "AddressLookUp Dns set bad dns name: blaha."); Assert.AreEqual(dns.AddressLookUp("C250001001.blah"), null, "AddressLookUp Dns set bad dns name: blah."); dns = new StaticDNS( MemBlock.Reference(Utils.StringToBytes("10.251.0.0", '.')), MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.'))); Assert.AreEqual(dns.NameLookUp("10.250.1.1"), null, "NameLookUp Dns changed out of range."); Assert.AreEqual(dns.NameLookUp("10.251.1.1"), "C251001001.ipop", "NameLookUp Dns changed in range."); }
public void SmallMaskTest() { StaticDNS dns = new StaticDNS( MemBlock.Reference(Utils.StringToBytes("10.1.2.0", '.')), MemBlock.Reference(Utils.StringToBytes("255.255.255.0", '.'))); Assert.AreEqual(dns.NameLookUp("10.1.2.94"), "C001002094.ipop"); Assert.AreEqual(dns.AddressLookUp("C001002094.ipop"), "10.1.2.94"); }