Exemplo n.º 1
0
        public void TakeShootTest_Hit()
        {
            Field field = new Field_Valid_OneShip();
            Point point = new Point(1);
            Ship  ship  = Ship.CreateNewShip(point, Orientation.Vertical, field.Ships[0].Id, field.Ships[0].Size);

            field.SetShip(ship);
            Assert.AreEqual(ShotResult.Hit, field.TakeShoot(point));
            Assert.AreEqual(CellStatus.Hit, field.Cells[point.Y, point.X]);
        }
Exemplo n.º 2
0
        public void GetShipTest_ValidTest()
        {
            Field field = new Field_Valid_OneShip();

            field.SetShip(Ship.CreateNewShip(
                              new Point(1),
                              Orientation.Vertical,
                              field.Ships[0].Id,
                              field.Ships[0].Size)
                          );
            ReferenceEquals(field.Ships[0], field.GetShip(new Point(1)));
        }
Exemplo n.º 3
0
        public void GetShipTest_NullTest()
        {
            Field field = new Field_Valid_OneShip();

            field.SetShip(Ship.CreateNewShip(
                              new Point(1),
                              Orientation.Vertical,
                              field.Ships[0].Id,
                              field.Ships[0].Size)
                          );
            Assert.IsNull(field.GetShip(new Point(0)));
        }
Exemplo n.º 4
0
        public void SetShipTest_InvalidShipId()
        {
            Field field = new Field_Valid_OneShip();

            Ship ship = Ship.CreateNewShip(
                field.Ships[0].StartPosition,
                Orientation.Horizontal,
                field.Ships[0].Id + 1,
                field.Ships[0].Size
                );

            field.SetShip(ship);
        }