本文整理汇总了C#中Cookie.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Cookie.GetHashCode方法的具体用法?C# Cookie.GetHashCode怎么用?C# Cookie.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Equals_Compare_Success
public static void Equals_Compare_Success()
{
Cookie c1 = new Cookie();
Cookie c2 = new Cookie("name", "value");
Cookie c3 = new Cookie("Name", "value");
Cookie c4 = new Cookie("different-name", "value");
Cookie c5 = new Cookie("name", "different-value");
Cookie c6 = new Cookie("name", "value", "path");
Cookie c7 = new Cookie("name", "value", "path");
Cookie c8 = new Cookie("name", "value", "different-path");
Cookie c9 = new Cookie("name", "value", "path", "domain");
Cookie c10 = new Cookie("name", "value", "path", "domain");
Cookie c11 = new Cookie("name", "value", "path", "Domain");
Cookie c12 = new Cookie("name", "value", "path", "different-domain");
Cookie c13 = new Cookie("name", "value", "path", "domain") { Version = 5 };
Cookie c14 = new Cookie("name", "value", "path", "domain") { Version = 5 };
Cookie c15 = new Cookie("name", "value", "path", "domain") { Version = 100 };
Assert.False(c2.Equals(null));
Assert.False(c2.Equals(""));
Assert.NotEqual(c1, c2);
Assert.Equal(c2, c3);
Assert.Equal(c3, c2);
Assert.NotEqual(c2, c4);
Assert.NotEqual(c2, c5);
Assert.NotEqual(c2, c6);
Assert.NotEqual(c2, c9);
Assert.NotEqual(c2.GetHashCode(), c4.GetHashCode());
Assert.NotEqual(c2.GetHashCode(), c5.GetHashCode());
Assert.NotEqual(c2.GetHashCode(), c6.GetHashCode());
Assert.NotEqual(c2.GetHashCode(), c9.GetHashCode());
Assert.Equal(c6, c7);
Assert.NotEqual(c6, c8);
Assert.NotEqual(c6, c9);
Assert.NotEqual(c6.GetHashCode(), c8.GetHashCode());
Assert.NotEqual(c6.GetHashCode(), c9.GetHashCode());
Assert.Equal(c9, c10);
Assert.Equal(c9, c11);
Assert.NotEqual(c9, c12);
Assert.Equal(c9.GetHashCode(), c10.GetHashCode());
Assert.NotEqual(c9.GetHashCode(), c12.GetHashCode());
Assert.Equal(c13, c14);
Assert.NotEqual(c13, c15);
Assert.Equal(c13.GetHashCode(), c14.GetHashCode());
Assert.NotEqual(c13.GetHashCode(), c15.GetHashCode());
}