public void CheckIfConsecutiveRandomNumbersAreDifferent()
        {
            RandomNumberGenerator randomNumber = new RandomNumberGenerator();
            int nextRandomNumber = randomNumber.Next();

            Assert.AreNotEqual(randomNumber, nextRandomNumber);
        }
        public void CheckIfGeneratedRandomNumberIsLessThanUpperLimit()
        {
            RandomNumberGenerator randomNumber = new RandomNumberGenerator();
            int testMaxValue = 257;
            int nextRandomNumber = randomNumber.Next(testMaxValue);

            Assert.IsTrue(nextRandomNumber < testMaxValue);
        }
        public void CheckIfGeneratedRandomNumberIsInInterval()
        {
            RandomNumberGenerator randomNumber = new RandomNumberGenerator();
            int testMinValue = 2014;
            int testMaxValue = 666666;
            int nextRandomNumber = randomNumber.Next(testMinValue, testMaxValue);

            Assert.IsTrue(nextRandomNumber < testMaxValue && nextRandomNumber > testMinValue);
        }
        public void CheckIfExitCommandConstructorWorksProperly()
        {
            IMatrixField field = FieldFactory.Instance.GetField(5);
            IScoreboard scoreboard = new ScoreboardProxy();
            IRandomNumberGenerator random = new RandomNumberGenerator();
            IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random);

            ExitCommand exitCommand = new ExitCommand(gameEngine);

            Assert.IsInstanceOfType(exitCommand, typeof(Command));
        }
        public void CheckIfmoveCellCommandCommandConstructorWorksProperly()
        {
            IMatrixField field = FieldFactory.Instance.GetField(5);
            IScoreboard scoreboard = new ScoreboardProxy();
            IRandomNumberGenerator random = new RandomNumberGenerator();
            IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random);
            string destination = "restart";

            MoveCellCommand moveCellCommand = new MoveCellCommand(gameEngine, destination);

            Assert.IsInstanceOfType(moveCellCommand, typeof(Command));
        }
        public void CheckIfMethodExitExecuteReturnsProperString()
        {
            IMatrixField field = FieldFactory.Instance.GetField(5);
            IScoreboard scoreboard = new ScoreboardProxy();
            IRandomNumberGenerator random = new RandomNumberGenerator();
            IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random);

            ExitCommand exitCommand = new ExitCommand(gameEngine);

            string result = exitCommand.Execute();

            Assert.AreEqual(result, GlobalConstants.ExitMessage);
        }
        public void CheckIfMethodTopExecuteReturnsProperEmptyString()
        {
            IMatrixField field = FieldFactory.Instance.GetField(5);
            IScoreboard scoreboard = new ScoreboardProxy();
            IRandomNumberGenerator random = new RandomNumberGenerator();
            IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random);

            TopCommand topCommand = new TopCommand(gameEngine);

            string result = topCommand.Execute();

            Assert.IsInstanceOfType(result, typeof(String));
        }
        /// <summary>
        /// Method to starts the game
        /// </summary>
        public static void Main()
        {
            IMatrixField field = FieldFactory.Instance.GetField(4);
            IScoreboard scoreboard = new ScoreboardProxy();
            IRandomNumberGenerator random = new RandomNumberGenerator();
            IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random);

            IRenderer renderer = new ConsoleRenderer();
            IInputHandler inputHandler = new InputHandler();
            IGameController gameFifteenControl = new GameController(gameEngine, inputHandler, renderer);

            gameFifteenControl.Start();
        }
        public void CheckIfMethodMoveCellCommandExecuteReturnsProperStringTwo()
        {
            IMatrixField field = FieldFactory.Instance.GetField(5);
            IScoreboard scoreboard = new ScoreboardProxy();
            IRandomNumberGenerator random = new RandomNumberGenerator();
            IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random);
            string destination = "9";

            MoveCellCommand moveCellCommand = new MoveCellCommand(gameEngine, destination);

            string result = moveCellCommand.Execute();

            Assert.IsInstanceOfType(result, typeof(String));
        }