本文整理汇总了C#中System.Net.Http.Headers.NameValueHeaderValue.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueHeaderValue.Equals方法的具体用法?C# NameValueHeaderValue.Equals怎么用?C# NameValueHeaderValue.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.Headers.NameValueHeaderValue
的用法示例。
在下文中一共展示了NameValueHeaderValue.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Equals_NameUseDifferentCasing_ConsideredEqual
public void Equals_NameUseDifferentCasing_ConsideredEqual()
{
NameValueHeaderValue nameValue1 = new NameValueHeaderValue("text");
NameValueHeaderValue nameValue2 = new NameValueHeaderValue("TEXT");
Assert.True(nameValue1.Equals(nameValue2), "text vs. TEXT.");
}
示例2: Equals_ValuesUseDifferentValues_ValuesAreEqualOrDifferentAccordingToRfc
public void Equals_ValuesUseDifferentValues_ValuesAreEqualOrDifferentAccordingToRfc()
{
NameValueHeaderValue nameValue1 = new NameValueHeaderValue("text");
NameValueHeaderValue nameValue2 = new NameValueHeaderValue("text");
nameValue1.Value = null;
nameValue2.Value = null;
Assert.True(nameValue1.Equals(nameValue2), "<null> vs. <null>.");
nameValue1.Value = "token";
nameValue2.Value = null;
Assert.False(nameValue1.Equals(nameValue2), "token vs. <null>.");
nameValue1.Value = null;
nameValue2.Value = "token";
Assert.False(nameValue1.Equals(nameValue2), "<null> vs. token.");
nameValue1.Value = string.Empty;
nameValue2.Value = "token";
Assert.False(nameValue1.Equals(nameValue2), "string.Empty vs. token.");
nameValue1.Value = null;
nameValue2.Value = string.Empty;
Assert.True(nameValue1.Equals(nameValue2), "<null> vs. string.Empty.");
nameValue1.Value = "token";
nameValue2.Value = "TOKEN";
Assert.True(nameValue1.Equals(nameValue2), "token vs. TOKEN.");
nameValue1.Value = "token";
nameValue2.Value = "token";
Assert.True(nameValue1.Equals(nameValue2), "token vs. token.");
nameValue1.Value = "\"quoted string\"";
nameValue2.Value = "\"QUOTED STRING\"";
Assert.False(nameValue1.Equals(nameValue2), "\"quoted string\" vs. \"QUOTED STRING\".");
nameValue1.Value = "\"quoted string\"";
nameValue2.Value = "\"quoted string\"";
Assert.True(nameValue1.Equals(nameValue2), "\"quoted string\" vs. \"quoted string\".");
Assert.False(nameValue1.Equals(null), "\"quoted string\" vs. <null>.");
}