示例#1
0
        public void WidthOrHeightCanNotBeLessZeroThrowException(string command)
        {
            ISurface landingSurface = new MarsSurface();

            var commandSplit = command.Split(' ');
            var width        = int.Parse(commandSplit[0]);
            var height       = int.Parse(commandSplit[1]);

            var action = new Action(() => landingSurface.SetSurface(new SurfaceModel()
            {
                Width  = width,
                Height = height
            }));

            action.Should().Throw <Exception>().WithMessage("width and height can not be less than zero");
        }
示例#2
0
        public void CreateSurfaceCorrectSize(string command)
        {
            ISurface landingSurface = new MarsSurface();

            var commandSplit = command.Split(' ');
            var width        = int.Parse(commandSplit[0]);
            var height       = int.Parse(commandSplit[1]);


            landingSurface.SetSurface(new SurfaceModel()
            {
                Width  = width,
                Height = height
            });


            landingSurface.Size.SurfaceModel.Width.Should().Be(width);
            landingSurface.Size.SurfaceModel.Height.Should().Be(height);
        }
示例#3
0
        public void HBRequired2(string command)
        {
            var plataue = new MarsSurface();

            plataue.SetSurface(new SurfaceModel()
            {
                Width = 5, Height = 5
            });
            var manager = new RoverManager(plataue);

            manager.LaunchRover(3, 3, Directions.E);
            var movements = command
                            .ToCharArray()
                            .Select(x => Enum.Parse <Movements>(x.ToString()))
                            .ToList();


            movements.ForEach(manager.Rover.Move);

            manager.Rover.Should().NotBeNull();
            manager.Rover.X.Should().Be(5);
            manager.Rover.Y.Should().Be(1);
            manager.Rover.Direction.Should().Be(Directions.E);
        }