本文整理汇总了C#中Category.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Category.Equals方法的具体用法?C# Category.Equals怎么用?C# Category.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CategoryEquality
public void CategoryEquality()
{
Category a = new Category("Hello");
Category b = new Category("Hello");
Assert.IsTrue(a == b, "Equality operator failed");
Assert.AreEqual(true, a.Equals(b), "Explicit call to IEquatable<T> method failed");
Assert.AreEqual(a, b, "Generic Assert.AreEqual call failed");
}
示例2: EqualsTest
public void EqualsTest()
{
Category target = new Category(); // TODO: Initialize to an appropriate value
Category other = null; // TODO: Initialize to an appropriate value
bool expected = false; // TODO: Initialize to an appropriate value
bool actual;
actual = target.Equals(other);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
示例3: EqualsTestInequality
public void EqualsTestInequality()
{
Category o1 = new Category(1, "foo");
Category o2 = new Category(2, "bar");
Assert.IsFalse(o1.Equals(o2));
}
示例4: EqualsTestEquality
public void EqualsTestEquality()
{
Category o1 = new Category(1, "foo");
Category o2 = new Category(1, "foo");
Assert.IsTrue(o1.Equals(o2));
}
示例5: EqualsTestReferenceEquals
public void EqualsTestReferenceEquals()
{
Category o1 = new Category(1, "foo");
Category o2 = o1;
Assert.IsTrue(o1.Equals(o2));
}
示例6: EqualsTestObjectReferenceEquality
public void EqualsTestObjectReferenceEquality()
{
Category o1 = new Category(1, "foo");
Object o2 = (Object)new Category(1, "foo");
Assert.IsTrue(o1.Equals(o2));
}