本文整理汇总了C#中Size.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Size.Equals方法的具体用法?C# Size.Equals怎么用?C# Size.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Size
的用法示例。
在下文中一共展示了Size.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericEqualsTest
public void GenericEqualsTest()
{
var target = new Size(5, 15);
object obj = new Size(5, 15);
const bool expected = true;
bool actual = target.Equals(obj);
Assert.AreEqual(expected, actual);
}
示例2: EqualsTest
public void EqualsTest()
{
var target = new Size(5, 15);
var other = new Size(5, 15);
const bool expected = true;
bool actual = target.Equals(other);
Assert.AreEqual(expected, actual);
}
示例3: EqualsTest
public void EqualsTest()
{
Size target = new Size(5, 15);
Size other = new Size(5, 15);
bool expected = true;
bool actual;
actual = target.Equals(other);
Assert.AreEqual(expected, actual);
}
示例4: ShouldEqualIdenticalSizeType
public void ShouldEqualIdenticalSizeType()
{
var a = new Size(0);
const size_t B = 0;
Assert.AreEqual(a, B, "AreEqual failed.");
Assert.True(a == B, "Equality op check failed.");
Assert.False(a != B, "Inequality op check failed.");
// ReSharper disable once SuspiciousTypeConversion.Global
Assert.True(a.Equals((object)B));
}
示例5: EqualityTest
public void EqualityTest(int width, int height)
{
Size p1 = new Size(width, height);
Size p2 = new Size(width - 1, height - 1);
Size p3 = new Size(width, height);
Assert.True(p1 == p3);
Assert.True(p1 != p2);
Assert.True(p2 != p3);
Assert.True(p1.Equals(p3));
Assert.False(p1.Equals(p2));
Assert.False(p2.Equals(p3));
Assert.Equal(p1.GetHashCode(), p3.GetHashCode());
}
示例6: EqualityTest_NotSize
public static void EqualityTest_NotSize()
{
var size = new Size(0, 0);
Assert.False(size.Equals(null));
Assert.False(size.Equals(0));
Assert.False(size.Equals(new SizeF(0, 0)));
}