Ejemplo n.º 1
0
        public void Game_start_NumberBelowRange()
        {
            Game       game = new Game();
            IUserInput fakeUserInput_NumberBelowRange = new FakeUserInput("-1");
            bool       gameFinishedSuccessfully;

            gameFinishedSuccessfully = game.Start(fakeUserInput_NumberBelowRange);
            Assert.IsFalse(gameFinishedSuccessfully);
        }
Ejemplo n.º 2
0
        public void Game_start_NoNumber()
        {
            Game       game = new Game();
            IUserInput fakeUserInput_NoNumber = new FakeUserInput("a");
            bool       gameFinishedSuccessfully;

            gameFinishedSuccessfully = game.Start(fakeUserInput_NoNumber);
            Assert.IsFalse(gameFinishedSuccessfully);
        }
Ejemplo n.º 3
0
        public void Game_StartTest_RegularNumber()
        {
            Game       game = new Game();
            IUserInput fakeUserInput_RegularNumber = new FakeUserInput("2");
            bool       gameFinishedSuccessfully;

            gameFinishedSuccessfully = game.Start(fakeUserInput_RegularNumber);
            Assert.IsTrue(gameFinishedSuccessfully);
        }
        public void MatrixRotatingWalk_ValidInput_ShouldReturnMatrix()
        {
            var fakeInput = new FakeUserInput();
            int matrixSize = int.Parse(fakeInput.GetInput());
            int[,] matrix = new int[matrixSize, matrixSize];
            RotatingWalkMatrix.MatrixRotatingWalk(matrix, matrixSize);
            using (StringWriter stringWriter = new StringWriter())
            {
                Console.SetOut(stringWriter);

                RotatingWalkMatrix.MatrixRotatingWalk(matrix, matrixSize);

                string expectedOutput = string.Format("  1  7  8{0}  6  2  9{0}  5  4  3{0}", Environment.NewLine);
                Assert.AreEqual<string>(expectedOutput, stringWriter.ToString());
            }
        }