public void TestSpecificity() { var p1 = new HostPredicate("*"); var p2 = HostPredicate.N1stParty; Assert.True(p1.Specificity < p2.Specificity, "\"*\"的规格强度小于\"1st-party\""); }
public static void TestGetRootDomain() { var addressPredicate = new HostPredicate("wenku.baidu.com"); Assert.Equal("baidu.com", addressPredicate.GetRootDomain()); //addressPredicate = new HostPredicate("1.2.3.4"); //Assert.ThrowsAny<Exception>(() => addressPredicate.GetRootDomain()); addressPredicate = new HostPredicate("baidu.com"); Assert.Equal("baidu.com", addressPredicate.GetRootDomain()); }