Rectangle Equals Method (Rectangle)Delta Engine Documentation

Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public bool Equals(
	Rectangle other
)

Return Value

Type: Boolean

Implements

IEquatable T  Equals(T)
Remarks

Tests: DeltaEngine.Tests.Datatypes.RectangleTests
Examples

2 unit tests call DeltaEngine.Datatypes.Rectangle.Equals(DeltaEngine.Datatypes.Rectangle)
[Test]
public void Equals()
{
    var rect1 = new Rectangle(3, 4, 1, 2);
    var rect2 = new Rectangle(5, 6, 1, 2);
    Assert.AreNotEqual(rect1, rect2);
    Assert.AreEqual(rect1, new Rectangle(3, 4, 1, 2));
    Assert.AreNotEqual(rect1, new Rectangle(3.00001f, 4, 1, 2));
    Assert.IsTrue(rect1 == new Rectangle(3, 4, 1, 2));
    Assert.IsTrue(rect1 != rect2);
    Assert.IsFalse(rect1.Equals(rect2));
    Assert.IsTrue(rect1.Equals(rect1));
    Assert.False(rect1.Equals((object)Rectangle.One));
}
[Test]
public void NearlyEquals()
{
    var rect1 = new Rectangle(3, 4, 1, 2);
    Assert.IsTrue(rect1.IsNearlyEqual(new Rectangle(3.00001f, 4, 1, 2)));
    Assert.IsTrue(rect1.IsNearlyEqual(new Rectangle(3, 4, 0.99999f, 2)));
    Assert.IsFalse(rect1.IsNearlyEqual(new Rectangle(3.01f, 4, 1, 2)));
    Assert.IsFalse(rect1.IsNearlyEqual(new Rectangle(3, 4, 0.999f, 2)));
}
See Also