コード例 #1
0
        private void CompareDice(int[] d1, int[] d2, int expect)
        {
            var helper = new DiceCompare();
            int result = helper.Compare(new Dice(d1), new Dice(d2));

            Assert.AreEqual(expect, result);
        }
コード例 #2
0
        private void FirstDiceShouldBiggerThanSecond(Dice dice1, Dice dice2)
        {
            var helper = new DiceCompare();
            int result = helper.Compare(dice1, dice2);

            Assert.IsTrue(result > 0);
        }
コード例 #3
0
        public void OrderTest()
        {
            var input = new List <Dice>
            {
                new Dice(new[] { 3, 5, 3, 1 }),
                new Dice(new[] { 1, 2, 3, 4 }),
                new Dice(new[] { 3, 3, 2, 4 }),
                new Dice(new[] { 1, 1, 1, 1 }),
                new Dice(new[] { 4, 4, 4, 4 }),
            };
            var helper = new DiceCompare();

            input.Sort(helper);
            input.Reverse();

            var expected = new List <Dice>
            {
                new Dice(new[] { 1, 1, 1, 1 }),
                new Dice(new[] { 4, 4, 4, 4 }),
                new Dice(new[] { 3, 5, 3, 1 }),
                new Dice(new[] { 3, 3, 2, 4 }),
                new Dice(new[] { 1, 2, 3, 4 })
            };

            Assert.IsTrue(input[0].dices.SequenceEqual(expected[0].dices));
            Assert.IsTrue(input[1].dices.SequenceEqual(expected[1].dices));
            Assert.IsTrue(input[2].dices.SequenceEqual(expected[2].dices));
            Assert.IsTrue(input[3].dices.SequenceEqual(expected[3].dices));
            Assert.IsTrue(input[4].dices.SequenceEqual(expected[4].dices));
        }
コード例 #4
0
        private void FirstDiceShouldEqualSecond(Dice dice1, Dice dice2)
        {
            var result = new DiceCompare().Compare(dice1, dice2);

            Assert.IsTrue(result == 0);
        }