Example #1
0
        public void ClassInit()
        {
            field = new GreenField();

            pirate = field.CurrentPirate;
            var cells = field.Cells(4, 5);

            cells.AddPirate(pirate);

            amazonCell = new AmazonCell(5, 5);
            field.InsertCell(amazonCell);
        }
        public void ShouldProvideAllPossibleDirectionsInMiddleOfField()
        {
            // Arrange
            var cell = field.Cells(3, 4);

            // Act
            var pirateCanMoveTo = cell.PirateCanMoveTo();

            // Assert
            pirateCanMoveTo.Count.ShouldBeEqual(9);
        }
Example #3
0
        public void ShouldBeAwareOfRestricedDirections()
        {
            //Arrange
            var field  = new GreenField();
            var pirate = field.CurrentPirate;

            //   1 2
            // 5 p <---- так ходить нельзя
            //Act                                                 // 6s
            field.MovePirateTo(pirate, field.Cells(1, 5));        // 7
                                                                  // 8
            //Assert
            pirate.Position
            .ShouldBeEqual(new Position(0, 6));
        }
Example #4
0
        public void ShipShouldRecognizeFriendlyPirate()
        {
            // precondition
            var oldCrew = blackShip.Pirates.Count;


            // arrange
            var waterCell = (WaterCell)field.Cells(1, 2);
            var pirateRed = teamRed.Pirates.Current;

            waterCell.AddPirate(pirateRed);

            // act
            blackShip.MoveTo(waterCell);

            // assert
            blackShip.Pirates.Count
            .ShouldBeEqual(oldCrew + 1);
        }
Example #5
0
        public void PathShouldContainCroco()
        {
            // Arrange
            var field = new GreenField();

            pirate = field.CurrentPirate;

            var startCell = field.Cells(3, 3);
            var crocoCell = new CrocoCell(4, 3);

            field.InsertCell(crocoCell);

            field.SetPirateOnCell(pirate, startCell);

            // Act
            field.MovePirateTo(pirate, crocoCell);

            // Assert
            pirate.Path.ShouldContain()
            .Elements(startCell.Position, crocoCell.Position, crocoCell.Position, startCell.Position);
        }