예제 #1
0
        public void Play_GivenNull_ShouldReturnMessage()
        {
            //Arrange
            var nullOrWhitespace = new NullOrWhitespace();
            var rock             = new WinnerRock();
            var paper            = new WinnerPaper();
            var scissor          = new WinnerScissors();

            nullOrWhitespace.SetSucessor(rock);
            rock.SetSucessor(paper);
            paper.SetSucessor(scissor);

            //Act
            var actual = nullOrWhitespace.Play(null, null);

            //Assert
            var expected = "Invalid input";

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void Play_GivenPaperAndScissors_ShouldReturnScissors()
        {
            //Arrange
            var player1          = "Paper";
            var player2          = "Scissors";
            var nullOrWhitespace = new NullOrWhitespace();
            var rock             = new WinnerRock();
            var paper            = new WinnerPaper();
            var scissor          = new WinnerScissors();

            nullOrWhitespace.SetSucessor(rock);
            rock.SetSucessor(paper);
            paper.SetSucessor(scissor);

            //Act
            var actual = nullOrWhitespace.Play(player1, player2);

            //Assert
            var expected = "Scissors has won";

            Assert.AreEqual(expected, actual);
        }