Esempio n. 1
0
 public void CreatePlateauAreaWithNegativeValue()
 {
     Assert.Throws <MarsRoverException>(() =>
     {
         var plateauArea = PlateauArea.Create(-3, -3);
     });
 }
Esempio n. 2
0
        private ICommand ParsePlateauSizeCommand(string toParse)
        {
            var arguments = toParse.Split(' ');
            var width     = int.Parse(arguments[0]);
            var height    = int.Parse(arguments[1]);
            var size      = new PlateauArea(width, height);

            var populatedCommand = _plateauSizeCommandFactory(size);

            return(populatedCommand);
        }
Esempio n. 3
0
        public async Task <RoverInvoker> CreatePlateauArea(string plateauAreaValue)
        {
            if (!canCreatePlateauArea(plateauAreaValue))
            {
                throw new MarsRoverException("Please check your plateau area command. It should be '5 5'", MarsRoverExceptionCode.CreatePlateauAreaError);
            }

            var values = plateauAreaValue.Split(new char[] { Constants.Characters.Space }, StringSplitOptions.RemoveEmptyEntries);
            int width  = values[0].ToInt32();
            int height = values[1].ToInt32();

            this._rover.PlateauArea = PlateauArea.Create(width, height);

            return(this);
        }
Esempio n. 4
0
 public void SetAreaSize(PlateauArea area)
 {
     PlateauArea = area;
 }
Esempio n. 5
0
 public SetPlateauAreaSizeCommand(PlateauArea area)
 {
     PlateauArea = area;
 }
Esempio n. 6
0
        public void CreatePlateauArea()
        {
            var plateauArea = PlateauArea.Create(5, 5);

            Assert.IsNotNull(plateauArea);
        }