public void EqualityTest() { // ReSharper disable SuspiciousTypeConversion.Global var range0 = new DoubleRange(-1.2, +3.4); var range1 = new DoubleRange(-1.2, +3.4); var range2 = new DoubleRange(0, +3.4); var range3 = new DoubleRange(-1.2, +3.5); var range4 = new DoubleRange(double.NaN, +3.4); var range5 = new DoubleRange(double.NaN, double.NaN); // Equals(DoubleRange) Assert.IsTrue(range0.Equals(range0)); Assert.IsTrue(range0.Equals(range1)); Assert.IsFalse(range0.Equals(range2)); Assert.IsFalse(range0.Equals(range3)); Assert.IsFalse(range0.Equals(range4)); Assert.IsTrue(range5.Equals(range5)); // Equals(object) Assert.IsTrue(range0.Equals((object)range0)); Assert.IsTrue(range0.Equals((object)range1)); Assert.IsFalse(range0.Equals((object)range2)); Assert.IsFalse(range0.Equals((object)range3)); Assert.IsFalse(range0.Equals((object)range4)); Assert.IsTrue(range5.Equals((object)range5)); Assert.IsFalse(range0.Equals(null)); Assert.IsFalse(range0.Equals(range0.ToString())); // == operator Assert.IsTrue(range0 == range1); Assert.IsFalse(range0 == range2); Assert.IsFalse(range0 == range3); Assert.IsFalse(range0 == range4); // != operator Assert.IsFalse(range0 != range1); Assert.IsTrue(range0 != range2); Assert.IsTrue(range0 != range3); Assert.IsTrue(range0 != range4); // ReSharper restore SuspiciousTypeConversion.Global }