Esempio n. 1
0
        public void TestMove_3()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            robot.Place(4, 0, Facing.EAST);

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 4,  Y: 0,  Facing: EAST", newState, "East move failed - outside table right edge");
        }
Esempio n. 2
0
        public void TestMove_4()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            robot.Place(0, 1, Facing.SOUTH);

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: SOUTH", newState, "South move successful");
        }
Esempio n. 3
0
        public void TestMove_2()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            robot.Place(0, 0, Facing.EAST);

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 1,  Y: 0,  Facing: EAST", newState, "East move successful");
        }
Esempio n. 4
0
        public void TestMove_1()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            var originalState = robot.ToString();

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual(originalState, newState, "Move action failed - No move before robot gets placed onto the table");
        }
Esempio n. 5
0
        public void TestMove_9()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            robot.Place(0, 4, Facing.NORTH);

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 4,  Facing: NORTH", newState, "North move failed - outside table top edge");
        }
Esempio n. 6
0
        public void TestMove_5()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            robot.Place(0, 0, Facing.SOUTH);

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: SOUTH", newState, "South move failed - outside table bottom edge");
        }
Esempio n. 7
0
        public void TestMove_3()
        {
            var mock = new Mock <IActionValidator>();

            mock.Setup(m => m.Validate(It.IsAny <int>(), It.IsAny <int>())).Returns(true);

            IActionable robot = new TableRobot(mock.Object);

            robot.Place(1, 1, Facing.SOUTH);

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 1,  Y: 0,  Facing: SOUTH", newState, "Move action (south) is successfull when validation is passed");
        }