Beispiel #1
0
        public void IfGameContextNullTest()
        {
            /* This test checking, what make program, when will send the wrong command,
             * When send wrong data, It should show "Unknown movement" message.
             * It will do nothing and pass another character
             */

            var algorithm = new GameAlgorithm(null);

            Assert.False(algorithm.CalculateGameResults(null));
        }
Beispiel #2
0
        public void CalculateGameResultsTest_WrongCommandTest()
        {
            /* This test checking, what make program, when will send the wrong command,
             * When send wrong data, It should show "Unknown movement" message.
             * It will do nothing and pass another character
             */

            var directory           = AppDomain.CurrentDomain.BaseDirectory;
            var gameSettings        = string.Format(directory + @"game-settings.txt");
            var gameSettingsService = new GameSettingsService(new ReadDataService());
            var gameContext         = gameSettingsService.PopulateGameSettings(gameSettings);
            var data     = new List <string>();
            var moveList = new List <string> {
                "k", "M", "L"
            };

            data.AddRange(moveList);
            gameContext.CommandList.Add(moveList);

            var algorithm = new GameAlgorithm(gameContext);

            Assert.False(algorithm.CalculateGameResults(gameContext));
        }