Exemplo n.º 1
0
        public void HeShouldContinueMovingInArrowDirection_Back()
        {
            // Arrange

            var testEmptyRules = new TestEmptyRules();
            var field          = new Field(testEmptyRules);


            var startCell  = field.Cells(3, 3);
            var arrow1Cell = new ArrowOneWayStraightCell(4, 3);

            arrow1Cell.SetField("direction", Direction.W);
            var endCell = field.Cells(5, 3);

            field.Draw(arrow1Cell);
            field.SetPirateOnCell(black, startCell);


            // Act
            field.SelectPirate(startCell);
            field.MovePirateTo(black, arrow1Cell);

            // Assert
            field.Cells(startCell.Position).Pirates.ShouldContain().Exact(black);
            field.Cells(arrow1Cell.Position).Pirates.ShouldBeEmpty();
            field.Cells(endCell.Position).Pirates.ShouldBeEmpty();
        }
Exemplo n.º 2
0
        public void HeShouldContinueMovingInPrevDirectionX2IceVert()
        {
            // Arrange
            var testEmptyRules = new TestEmptyRules();
            var field          = new Field(testEmptyRules);

            var startCell = field.Cells(3, 3);
            var iceCell1  = new IceCell(3, 4);
            var iceCell2  = new IceCell(3, 5);
            var endCell   = field.Cells(3, 6);

            field.Draw(iceCell1);
            field.Draw(iceCell2);
            field.SetPirateOnCell(black, startCell);

            // Act
            field.SelectPirate(startCell);
            field.MovePirateTo(black, iceCell1);

            // Assert
            field.Cells(startCell.Position).Pirates.ShouldBeEmpty();
            field.Cells(iceCell1.Position).Pirates.ShouldBeEmpty();
            field.Cells(iceCell2.Position).Pirates.ShouldBeEmpty();
            field.Cells(endCell.Position).Pirates.ShouldContain().Exact(black);
        }
Exemplo n.º 3
0
        public void TestInit()
        {
            rule  = new TestEmptyRules();
            field = new FieldStub(rule);
            field.GeneratePlayers(rule);

            team = field.CurrentPlayer.CurrentTeam;
            team.Ship.SetStrategy();
        }
Exemplo n.º 4
0
        public void ShouldBeAbleCreateAmazoneCell()
        {
            //Arrange
            var rule = new TestEmptyRules {
                Amazon = 3
            };
            var field = new Field(rule);

            //Assert
            field.GetPlayableArea()
            .ShouldContain()
            .CellsOf(CellType.Amazon).Count()
            .ShouldBeEqual(3);
        }
Exemplo n.º 5
0
        public void ShouldBeAbleCreateIceCell()
        {
            //Arrange
            var rule = new TestEmptyRules {
                Ice = 4
            };

            // Act
            var field = new Field(rule);

            //Assert
            field.GetPlayableArea()
            .ShouldContain()
            .CellsOf(CellType.Ice).Count()
            .ShouldBeEqual(4);
        }
Exemplo n.º 6
0
        public void ShouldCreateMostPossibleCells()
        {
            //Arrange
            var rule = new TestEmptyRules {
                Amazon = 30000
            };
            var field = new Field(rule);


            //Act

            //Assert
            field.GetPlayableArea()
            .ShouldContain()
            .OnlyCellsOf(CellType.Amazon);
        }
Exemplo n.º 7
0
        public void ShouldBeAbleCreateArrow1Cell()
        {
            //Arrange
            var rule = new TestEmptyRules {
                ArrowOneWayS = 2
            };

            // Act
            var field = new Field(rule);


            //Assert
            field.GetPlayableArea()
            .ShouldContain()
            .CellsOf(CellType.ArrowOneWayS).Count()
            .ShouldBeEqual(2);
        }
Exemplo n.º 8
0
        public void HeCanNotStayOnCrocoCell()
        {
            // Arrange
            var testEmptyRules = new TestEmptyRules();
            var field          = new Field(testEmptyRules);

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

            field.Draw(crocoCell);
            field.SetPirateOnCell(pirate, startCell);

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

            // Assert
            startCell.Pirates.ShouldContain().Exact(pirate);
            crocoCell.Pirates.ShouldBeEmpty();
        }
Exemplo n.º 9
0
        public void CanComeFrom()
        {
            // Arrange
            var testEmptyRules = new TestEmptyRules();
            var field          = new Field(testEmptyRules);

            var startCell = field.Cells(3, 3);
            var amazon    = new AmazonCell(4, 3);

            field.Draw(amazon);
            field.SetPirateOnCell(pirate, startCell);


            // Act
            field.SelectPirate(startCell);
            field.MovePirateTo(pirate, amazon);

            // Assert
            field.Cells(startCell.Position).Pirates.ShouldBeEmpty();
            field.Cells(amazon.Position).Pirates.ShouldContain().Exact(pirate);
        }
Exemplo n.º 10
0
        public void ShouldBeAbleCreateGold5Cell()
        {
            //Arrange
            var rule = new TestEmptyRules();

            rule.Golds = new List <int> {
                5,
                4,
                3,
                2,
                1
            };
            var field = new Field(rule);


            //Assert
            field.GetPlayableArea()
            .ShouldContain()
            .CellsOf(CellType.Gold5).Count()
            .ShouldBeEqual(1);
        }
Exemplo n.º 11
0
        public void HeShouldBeShootedToTheEdgeN()
        {
            // Arrange
            var testEmptyRules = new TestEmptyRules();
            var field          = new Field(testEmptyRules);

            var startCell  = field.Cells(3, 3);
            var cannonCell = new CannonCell(4, 3);

            cannonCell.SetField("cannonDirection", CannonDirection.North);
            var endCell = field.Cells(4, 0);

            field.Draw(cannonCell);
            field.SetPirateOnCell(black, startCell);

            // Act
            field.SelectPirate(startCell);
            field.MovePirateTo(black, cannonCell);

            // Assert
            field.Cells(startCell.Position).Pirates.ShouldBeEmpty();
            field.Cells(cannonCell.Position).Pirates.ShouldBeEmpty();
            field.Cells(endCell.Position).Pirates.ShouldContain().Exact(black);
        }
Exemplo n.º 12
0
        public void ShouldNotFillWater()
        {
            //Arrange
            var rule = new TestEmptyRules {
                Amazon = 30000
            };
            var field = new Field(rule);


            //Assert
            field.GetColumns().First()
            .ShouldContain()
            .OnlyCellsOf(CellType.Water);

            field.GetColumns().Last()
            .ShouldContain()
            .OnlyCellsOf(CellType.Water);

            field.GetRows().First()
            .ShouldContain()
            .OnlyCellsOf(CellType.Water);

            field.GetRows().Last()
            .ShouldContain()
            .OnlyCellsOf(CellType.Water);

            field.GetColumn(1)
            .ShouldContain()
            .CellsOf(CellType.Water).Count()
            .ShouldBeEqual(4);

            field.GetColumn(Position.MaxColumn - 2)
            .ShouldContain()
            .CellsOf(CellType.Water).Count()
            .ShouldBeEqual(4);
        }
Exemplo n.º 13
0
        public void TestInit()
        {
            var testEmptyRules = new TestEmptyRules();

            field = new Field(testEmptyRules);
        }
Exemplo n.º 14
0
 public void TestInit()
 {
     rule  = new TestEmptyRules();
     field = new FieldStub(rule);
 }
Exemplo n.º 15
0
 public void ClassInit()
 {
     //Arrange
     rule  = new TestEmptyRules();
     field = new Field(rule);
 }