本文整理汇总了C#中CallInfo.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# CallInfo.Equals方法的具体用法?C# CallInfo.Equals怎么用?C# CallInfo.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CallInfo
的用法示例。
在下文中一共展示了CallInfo.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EqualityBasedOnNamesAndCount
public void EqualityBasedOnNamesAndCount()
{
string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
for (int i = 0; i <= names.Length; ++i)
{
for (int j = 0; j != 3; ++j)
{
for (int x = 0; x <= names.Length; ++x)
{
for (int y = 0; y != 3; ++y)
{
var info0 = new CallInfo(i + j, names.Take(i));
var info1 = new CallInfo(x + y, names.Take(x));
Assert.Equal(i == x & j == y, info0.Equals(info1));
}
}
}
}
}
示例2: HashCodeBasedOnEquality
public void HashCodeBasedOnEquality()
{
string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
for (int i = 0; i <= names.Length; ++i)
{
for (int j = 0; j != 3; ++j)
{
for (int x = 0; x <= names.Length; ++x)
{
for (int y = 0; y != 3; ++y)
{
var info0 = new CallInfo(i + j, names.Take(i));
var info1 = new CallInfo(x + y, names.Take(x));
if (info0.Equals(info1))
{
Assert.Equal(info0.GetHashCode(), info1.GetHashCode());
}
else
{
// Failure at this point is not definitely a bug,
// but should be considered a concern unless it can be
// convincingly ruled a fluke.
Assert.NotEqual(info0.GetHashCode(), info1.GetHashCode());
}
}
}
}
}
}
示例3: NotEqualToNonCallInfo
public void NotEqualToNonCallInfo()
{
var info = new CallInfo(0);
Assert.False(info.Equals(null));
Assert.False(info.Equals("CallInfo"));
Assert.False(info.Equals(23));
}