Example #1
0
        public void Line5_to_RoverCommandListBuilder()
        {
            IRoverCommandParser roverCommandParser = new RoverCommandParser(plateauBuilder, roverBuilder, roverCommandListBuilder);

            roverCommandParser.Parse(arguments.ToString());

            roverCommandListBuilder.Received().Init(Arg.Any <Rover>(), "RMLMR");
        }
Example #2
0
        public void Line4_to_RoverBuilder()
        {
            IRoverCommandParser roverCommandParser = new RoverCommandParser(plateauBuilder, roverBuilder, roverCommandListBuilder);

            roverCommandParser.Parse(arguments.ToString());

            roverBuilder.Received().Init("2 2 S", Arg.Any <Plateau>());
        }
        public void ShouldThrowExceptionWhenParseInvalidInput()
        {
            var parser = new RoverCommandParser();

            var result = Record.Exception(() => parser.Parse("ABCD"));

            result.ShouldBeType<ParserException>();
        }
Example #4
0
        public void Line1_to_plateauBuilder()
        {
            IRoverCommandParser roverCommandParser = new RoverCommandParser(plateauBuilder, roverBuilder, roverCommandListBuilder);

            roverCommandParser.Parse(arguments.ToString());

            plateauBuilder.Received().Init("5 5");
        }
        public void ShouldParseValidInput()
        {
            var parser = new RoverCommandParser();
            var expected = new List<IRoverCommand>() { new TurnLeftCommand(), new TurnRightCommand(), new MoveFowardCommand(), new TurnRightCommand(), new TurnLeftCommand() };

            var result = parser.Parse("LRMRL").ToList();

            result[0].ShouldBeType(expected[0].GetType());
            result[1].ShouldBeType(expected[1].GetType());
            result[2].ShouldBeType(expected[2].GetType());
            result[3].ShouldBeType(expected[3].GetType());
            result[4].ShouldBeType(expected[4].GetType());
        }