public void ScoresPassValueThrough() { var scoreB = new HighestPointsScore(1.337); var scoreC = new LowestTimeScore(1337); var scoreD = new HighestTimeScore(1337); Assert.AreEqual(1.337, scoreB.Points); Assert.AreEqual(1337, scoreC.Milliseconds); Assert.AreEqual(1337, scoreD.Milliseconds); }
public void HighestTimeWins() { var scoreNull = (HighestTimeScore)null; Assert.IsNull(scoreNull + scoreNull); var scores = new HighestTimeScore[10]; for (int i = 0; i < scores.Length; i++) { scores[i] = new HighestTimeScore(i); } for (int a = 0; a < scores.Length; a++) { var scoreA = scores[a]; var valueA = scoreA.Milliseconds; Assert.IsTrue(scoreA.CompareTo(scoreNull) > 0); Assert.IsTrue(scoreA > scoreNull); Assert.IsTrue(scoreA >= scoreNull); Assert.IsFalse(scoreA == scoreNull); Assert.IsFalse(scoreA.Equals((object)scoreNull)); Assert.IsTrue(scoreA != scoreNull); Assert.IsFalse(scoreA < scoreNull); Assert.IsFalse(scoreA <= scoreNull); Assert.IsFalse(scoreNull > scoreA); Assert.IsFalse(scoreNull >= scoreA); Assert.IsFalse(scoreNull == scoreA); Assert.IsTrue(scoreNull != scoreA); Assert.IsTrue(scoreNull < scoreA); Assert.IsTrue(scoreNull <= scoreA); Assert.IsTrue(scoreA == scoreA + scoreNull); Assert.IsTrue(scoreA == scoreNull + scoreA); for (int b = 0; b < scores.Length; b++) { var scoreB = scores[b]; var valueB = scoreB.Milliseconds; Assert.AreEqual(valueA.CompareTo(valueB), scoreA.CompareTo(scoreB)); Assert.AreEqual(valueA > valueB, scoreA > scoreB); Assert.AreEqual(valueA >= valueB, scoreA >= scoreB); Assert.AreEqual(valueA == valueB, scoreA == scoreB); Assert.AreEqual(valueA != valueB, scoreA != scoreB); Assert.AreEqual(valueA.Equals(valueB), scoreA.Equals((object)scoreB)); Assert.AreEqual(valueA <= valueB, scoreA <= scoreB); Assert.AreEqual(valueA < valueB, scoreA < scoreB); } } }