Example #1
0
        public void Plateau_Should_Add_Rover()
        {
            // Arrange
            plateau.AddRover(rover);
            plateau.AddRover(rover);

            // Assert
            Assert.Equal(2, plateau.Rovers.Count);
        }
        public void Plateau_AddRover()
        {
            _plateau.SetSize("5 5");

            _rover.SetPosition("1 2 N");

            _plateau.AddRover(_rover);

            Assert.AreEqual(1, _plateau.Rovers.Count);
        }
Example #3
0
        public void Land(IPlateau plateau, Position position)
        {
            #region Validations
            if (plateau is null)
            {
                throw new ValidationException("Plateau is not null");
            }
            if (position is null)
            {
                throw new ValidationException("Plateau is not null");
            }
            if (plateau.Width < position.X)
            {
                throw new ValidationException("Plateau X dimention is not lass than positon X");
            }
            if (plateau.Heigth < position.Y)
            {
                throw new ValidationException("Plateau Y dimention is not lass than positon Y");
            }
            if (position.X < 0)
            {
                throw new ValidationException("Position X is not less than 0");
            }
            if (position.Y < 0)
            {
                throw new ValidationException("Position Y is not less than 0");
            }
            #endregion

            Plateau = plateau;
            Plateau.AddRover(this);
            Position = position;
            IsLanded = true;
        }