Пример #1
0
        public void ShifumiTest()
        {
            JediTournamentManager jtm = new JediTournamentManager();

            // Les trois cas où il y a egalite
            int expectedValue = 0; 
            int computedValue = jtm.playRound(EShifumi.Papier, 
                                              EShifumi.Papier);
            Assert.AreEqual(expectedValue, computedValue);

            computedValue = jtm.playRound(EShifumi.Pierre,
                                          EShifumi.Pierre);
            Assert.AreEqual(expectedValue, computedValue);

            computedValue = jtm.playRound(EShifumi.Ciseau,
                                          EShifumi.Ciseau);
            Assert.AreEqual(expectedValue, computedValue);

            // Les trois cas où le premier gagne
            expectedValue = -1;
            computedValue = jtm.playRound(EShifumi.Papier,
                                          EShifumi.Pierre);
            Assert.AreEqual(expectedValue, computedValue);

            computedValue = jtm.playRound(EShifumi.Pierre,
                                          EShifumi.Ciseau);
            Assert.AreEqual(expectedValue, computedValue);

            computedValue = jtm.playRound(EShifumi.Ciseau,
                                          EShifumi.Papier);
            Assert.AreEqual(expectedValue, computedValue);

            // Les trois cas où le deuxième gagne
            expectedValue = 1;
            computedValue = jtm.playRound(EShifumi.Papier,
                                          EShifumi.Ciseau);
            Assert.AreEqual(expectedValue, computedValue);

            computedValue = jtm.playRound(EShifumi.Pierre,
                                          EShifumi.Papier);
            Assert.AreEqual(expectedValue, computedValue);

            computedValue = jtm.playRound(EShifumi.Ciseau,
                                          EShifumi.Pierre);
            Assert.AreEqual(expectedValue, computedValue);
        }