public void CompareToTest() { //Arrange Fraction a = new Fraction(2, 5); Fraction a_str = new Fraction(20, 50); Fraction b = new Fraction(1, 2); Fraction c = b.Clone() as Fraction; c.Numerator *= 2; c.Denominator *= 2; Fraction d = -(b.Clone() as Fraction); //Act var result1 = b.CompareTo(a); var result2 = c.CompareTo(b); var result3 = d.CompareTo(a); var result4 = a.CompareTo(a_str); //Assert Assert.AreEqual(1, result1); Assert.AreEqual(0, result2); Assert.AreEqual(-1, result3); Assert.AreEqual(0, result4); }
public void CompareToNullTest() { Fraction a = new Fraction(2, 5); a.CompareTo(null); }