Example #1
0
        public void Move_TableTop5Into5Placed3Into3RobotMovedFiveTimesForward()
        {
            //arrange
            TableTop     tt = new TableTop(5, 5);
            ToyRobot     tr = new ToyRobot();
            CommandModel cm = new CommandModel()
            {
                Command    = Command.PLACE,
                Coordinate = new Coordinate(3, 3),
                Facing     = Facing.NORTH
            };
            ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt);

            placeCommand.Execute();

            ICommandInterface moveCommand = new MoveForwardCommand(tr, tt);

            //act
            moveCommand.Execute();
            moveCommand.Execute();
            moveCommand.Execute();
            moveCommand.Execute();
            moveCommand.Execute();


            //assert: actual/expected
            Assert.IsTrue(tr.RobotStillOnTableTop(tt));
        }
        public void ToyRobot_TableTop5Into5PlaceRobot3Into6AndRobotOnTableTopIsFalse()
        {
            //arrange
            //arrange
            TableTop     tt = new TableTop(5, 5);
            ToyRobot     tr = new ToyRobot();
            CommandModel cm = new CommandModel()
            {
                Command    = Command.PLACE,
                Coordinate = new Coordinate(3, 6),
                Facing     = Facing.NORTH
            };
            ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt);

            //act
            placeCommand.Execute();

            //assert
            Assert.IsFalse(tr.isRobotPlaced && tr.RobotStillOnTableTop(tt));
        }