示例#1
0
        public void getRobotR2()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            var resultRobot = mockRobotInstructions.GetRobot("r2");

            Assert.NotNull(resultRobot);
        }
示例#2
0
        public void RobotControllerTestM()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            mockRobotInstructions.getRobotInstructions("r1");

            Assert.NotNull(mockRobotInstructions);
        }
示例#3
0
        public void robotGetInstructionS4()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            // Shoul be Empty.
            var result   = mockRobotInstructions.getRobotInstructions("r4");
            var expected = "NMMLMMLMMMMM";

            Assert.Equal(expected, result);
        }
示例#4
0
        public void robotGetInstructions()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            // Shoul be Empty.
            // Gave a non existing Key
            var result = mockRobotInstructions.getRobotInstructions("r0");

            Assert.Null(result);
        }
示例#5
0
        public void PrintTest()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            // Shoul be Empty.
            var moveInstructions = mockRobotInstructions.getRobotInstructions("r1");
            var charArr          = moveInstructions.ToCharArray();
            var r1 = mockRobotInstructions.GetRobot("r1");

            robotController = new RobotController(repository);
            ;
        }
示例#6
0
        public void RobotR4CheckFaults()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            // Shoul be Empty.
            var moveInstructions = mockRobotInstructions.getRobotInstructions("r4");
            var charArr          = moveInstructions.ToCharArray();
            var r4 = mockRobotInstructions.GetRobot("r4");

            robotController = new RobotController(repository);
            var final  = robotController.MoveRobot(r4, charArr);
            var result = final.Faults;

            Assert.NotEqual(3, result);
        }
        public void robotInstruction(string key)
        {
            mockRobotInstructions = new MockRobotInstructions(_repository);
            //Get Instructions
            char[] charInstructList = mockRobotInstructions
                                      .getRobotInstructions(key)
                                      .ToCharArray();
            //

            // Get Robot plus initial values.
            Console.WriteLine(charInstructList);
            var robotInitial = mockRobotInstructions.GetRobot(key);

            // Move Robot function.
            MoveRobot(robotInitial, charInstructList);
        }
        public void RobotControllerCommands()
        {
            var _repository     = new Mock <IRepository>();
            var robotController = new RobotController(
                _repository.Object
                );


            var data = new MockRobotInstructions();

            var result = data.getRobotInstructions("r1");

            _repository.Verify(r => r.getRobotInstructions("r2"));

            Assert.IsNotNull(result);
        }
示例#9
0
        public void moveRobotR4FinalPosition()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            // Shoul be Empty.
            var robotInstructions = mockRobotInstructions.getRobotInstructions("r4");
            var CharArr           = robotInstructions.ToCharArray();
            var r4 = mockRobotInstructions.GetRobot("r4");

            robotController = new RobotController(repository);

            var result = robotController.MoveRobot(r4, CharArr);
            // FInal position expectation for r1
            var expected = new Robot(new Location(0, 0, 'S'));

            expected.Faults = 3;
            Assert.NotEqual(expected, result);
        }
示例#10
0
        public void moveRobotR1()
        {
            mockRobotInstructions = new MockRobotInstructions(repository);
            // Shoul be Empty.
            var MoveInstructions = mockRobotInstructions.getRobotInstructions("r1");

            var charrArr    = MoveInstructions.ToCharArray();
            var resultRobot = mockRobotInstructions.GetRobot("r1");

            robotController = new RobotController(repository);

            var r1 = robotController.MoveRobot(resultRobot, charrArr);

            var expected = new Robot(new Location(0, 3, 'N'));

            expected.Faults = 0;
            Assert.Equal(expected, r1);
        }
示例#11
0
 public RobotRepository(MockRobotInstructions mockRobotInstructions)
 {
     _mockRobotInstructions = mockRobotInstructions;
 }