Exemple #1
0
        public void LowestScoreWins()
        {
            var scoreNull = (LowestPointsScore)null;

            Assert.IsNull(scoreNull + scoreNull);

            var scores = new LowestPointsScore[10];
            for (int i = 0; i < scores.Length; i++)
            {
                scores[i] = new LowestPointsScore((double)i);
            }

            for (int a = 0; a < scores.Length; a++)
            {
                var scoreA = scores[a];
                var valueA = scoreA.Points;

                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.Points;

                    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);
                }
            }
        }
Exemple #2
0
        public void Points_PassesValueThrough()
        {
            var scoreA = new LowestPointsScore(1.337);

            Assert.AreEqual(1.337, scoreA.Points);
        }