public void GetDomainName_withoutComment() { MainWindowViewModel vm = new MainWindowViewModel(); Type t = vm.GetType(); MethodInfo m = t.GetMethod("GetDomainName", BindingFlags.Instance | BindingFlags.NonPublic); string test = "0.0.0.0 google.com"; string expected = "google.com"; string actual = (string)m.Invoke(vm, new object[] { (string)test }); Assert.AreEqual<string>(expected, actual); }
public void FormatDomainName() { MainWindowViewModel vm = new MainWindowViewModel(); Type t = vm.GetType(); MethodInfo m = t.GetMethod("FormatDomainName", BindingFlags.Instance | BindingFlags.NonPublic); string test = "google.com"; string expected = "zone \"google.com\" { type master; file \"/etc/bind/zones/db.poison\"; };"; string actual = (string)m.Invoke(vm, new object[] { (string)test }); Assert.AreEqual<string>(expected, actual); }