public void CompareBetweenCelsiusTemps() { Random rand = new Random(); double randDbl1 = rand.NextDouble() * 100; double randDbl2 = rand.NextDouble() * 100; IScaledValue temp1 = new Celsius(randDbl1); IScaledValue temp2 = new Celsius(randDbl2); if (randDbl1 > randDbl2) { Assert.AreEqual(1, temp1.Compare(temp2)); } else if (randDbl1 == randDbl2) { Assert.AreEqual(0, temp1.Compare(temp2)); } else { Assert.AreEqual(-1, temp1.Compare(temp2)); } }
public void CompareBetweenCelsiusAndFahrenheitTemps() { Random rand = new Random(); double randDbl1 = rand.NextDouble() * 100; double randDbl2 = rand.NextDouble() * 100; IScaledValue temp1 = new Celsius(randDbl1); //Let's assume both the randomed numbers are in celsius //So for temp2 as a Fahrenheit temp, we pass in randDbl2 to CelsiusValue IScaledValue temp2 = new Fahrenheit(); temp2.CelsiusValue = randDbl2; if (randDbl1 > randDbl2) { Assert.AreEqual(1, temp1.Compare(temp2)); } else if (randDbl1 == randDbl2) { Assert.AreEqual(0, temp1.Compare(temp2)); } else { Assert.AreEqual(-1, temp1.Compare(temp2)); } }