public void Test() { StaticDns dns = new StaticDns( MemBlock.Reference(Utils.StringToBytes("10.250.0.0", '.')), MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.')), string.Empty, false); Assert.AreEqual(dns.NameLookUp("10.250.1.1"), "C250001001.ipop", "NameLookUp Dns set in range."); try { Assert.AreEqual(dns.NameLookUp("10.251.1.1"), null, "NameLookUp Dns set out of range."); } catch { } Assert.AreEqual(dns.AddressLookUp("C250001001.ipop"), "10.250.1.1", "AddressLookUp Dns set."); try { Assert.AreEqual(dns.AddressLookUp("C250001001.blaha"), null, "AddressLookUp Dns set bad dns name: blaha."); } catch { } try { Assert.AreEqual(dns.AddressLookUp("C250001001.blah"), null, "AddressLookUp Dns set bad dns name: blah."); } catch { } dns = new StaticDns( MemBlock.Reference(Utils.StringToBytes("10.251.0.0", '.')), MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.')), string.Empty, false); try { Assert.AreEqual(dns.NameLookUp("10.250.1.1"), null, "NameLookUp Dns changed out of range."); } catch { } 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", '.')), string.Empty, false); Assert.AreEqual(dns.NameLookUp("10.1.2.94"), "C001002094.ipop", "test1"); Assert.AreEqual(dns.AddressLookUp("C001002094.ipop"), "10.1.2.94", "test2"); }