public void TryingSetFieldOnWrongCoordinatesShouldThrowException()
        {
            _game = new GameClassForTest(_pathToCorrectMap);

            var map = _game.GetMap();

            map[new Coordinates(-1, 0)] = FieldTypes.Player;
        }
        public void GetValueFromWrongCoordinatesShouldReturnCorrectValue()
        {
            _game = new GameClassForTest(_pathToCorrectMap);
            var map = _game.GetMap();

            var actual = map[new Coordinates(map.Params.MapSize["height"], map.Params.MapSize["width"])];

            Assert.AreEqual(FieldTypes.BeyondMap, actual);
        }
示例#3
0
        public void WhenDestinationReachedEventShouldCalled()
        {
            string sequenceOfCommands = "ssdddww";
            var    game = new GameClassForTest(_pathToCorrectMap, new CommandsEventLoop(sequenceOfCommands));
            bool   flag = false;

            game.GetPlayer().DestinationReached += (object sender, EventArgs args) => flag = true;
            game.Start();

            Assert.IsTrue(flag);
        }
示例#4
0
        public void PlayerMovementsTest(string sequenceOfCommands, int expectedX, int expectedY)
        {
            var game = new GameClassForTest(_pathToCorrectMap, new CommandsEventLoop(sequenceOfCommands));

            game.Start();

            var expected = new Coordinates(expectedX, expectedY);
            var actual   = game.GetPlayer().CurrentCoordinates;

            // AreEqual требует перегрузки ==, но с этим как-то не задалось(
            Assert.IsTrue(actual.Equals(expected));
        }
 public void MapWithIncorrectSizeShouldThrowException()
 {
     // непонятно почему такое исключение и не все тест case`ы покрыты
     _game = new GameClassForTest(_pathToMapWithIncorrectSize);
 }
 public void BuildingCorrectMapShouldNotCrash()
 {
     _game = new GameClassForTest(_pathToCorrectMap);
 }
 public void MapWithUnsupportedSymbolsShoulsThrowExceptionWhileBuilding()
 {
     _game = new GameClassForTest(_pathToMapWithUnsupportedSymbols);
 }
 public void MapWith0DestinationsShoulsThrowExceptionWhileBuilding()
 {
     _game = new GameClassForTest(_pathToMapWith0Destinations);
 }
 public void MapWith2AvatarsShoulsThrowExceptionWhileBuilding()
 {
     _game = new GameClassForTest(_pathToMapWith2Avatars);
 }