예제 #1
0
        public void TestCanAction_5()
        {
            var         mock  = new Mock <IActionValidator>();
            IActionable robot = new TableRobot(mock.Object);

            Assert.AreEqual(false, robot.CanAction(ActionType.REPORT), "Report action cannot be taken before the robot gets placed onto the table.");
        }
예제 #2
0
        public void TestCanAction_1()
        {
            var         mock  = new Mock <IActionValidator>();
            IActionable robot = new TableRobot(mock.Object);

            Assert.AreEqual(true, robot.CanAction(ActionType.PLACE), "Place action can always be taken.");
        }
예제 #3
0
        public void TestToString()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            var result = robot.ToString();

            Assert.AreEqual("X: -1,  Y: -1,  Facing: NORTH", result, "Test Robot.ToString()");
        }
예제 #4
0
        public void TestReport_1()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            var report = robot.Report();

            Assert.AreEqual(string.Empty, report, "Report action failed - No report before robot gets placed onto the table");
        }
예제 #5
0
        public void TestCanAction_9()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

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

            Assert.AreEqual(true, robot.CanAction(ActionType.REPORT), "Report action can be taken after the robot gets placed onto the table.");
        }
예제 #6
0
        public void TestReport_2()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

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

            var report = robot.Report();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: NORTH", report, "Report action successful");
        }
예제 #7
0
        public void TestPlace_2()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

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

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: EAST", newState, "Place action successful");
        }
예제 #8
0
        public void TestToString()
        {
            var mock = new Mock <IActionValidator>();

            IActionable robot = new TableRobot(mock.Object);

            var result = robot.ToString();

            Assert.AreEqual("X: -1,  Y: -1,  Facing: NORTH", result, "Test Robot.ToString()");
        }
예제 #9
0
        public void TestCanAction_9()
        {
            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(0, 0, Facing.NORTH);

            Assert.AreEqual(true, robot.CanAction(ActionType.REPORT), "Report action can be taken after the robot gets placed onto the table.");
        }
예제 #10
0
        public void TestReport_1()
        {
            var mock = new Mock <IActionValidator>();

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

            IActionable robot = new TableRobot(mock.Object);

            var report = robot.Report();

            Assert.AreEqual(string.Empty, report, "Report action failed when validation is not passed");
        }
예제 #11
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");
        }
예제 #12
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");
        }
예제 #13
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");
        }
예제 #14
0
        public void TestMove_6()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

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

            robot.Move();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: WEST", newState, "West move successful");
        }
예제 #15
0
        public void TestRight_5()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

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

            robot.Right();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: EAST", newState, "Right action sucessful - from north to east");
        }
예제 #16
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");
        }
예제 #17
0
        public void TestRight_4()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

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

            robot.Right();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: NORTH", newState, "Right action sucessful - from west to north");
        }
예제 #18
0
        public void TestPlace_1()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            var originalState = robot.ToString();

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

            var newState = robot.ToString();

            Assert.AreEqual(originalState, newState, "Place action failed - outside table");
        }
예제 #19
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");
        }
예제 #20
0
        public void TestReport_2()
        {
            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.WEST);

            var report = robot.Report();

            Assert.AreEqual("X: 1,  Y: 1,  Facing: WEST", report, "Report action successful when validation is passed");
        }
예제 #21
0
        public void TestMove_1()
        {
            var mock = new Mock <IActionValidator>();

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

            IActionable robot = new TableRobot(mock.Object);

            var originalState = robot.ToString();

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

            var newState = robot.ToString();

            Assert.AreEqual(originalState, newState, "Move action is failed when validation is not passed");
        }
예제 #22
0
        public void TestLeft_5()
        {
            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(0, 0, Facing.EAST);

            robot.Left();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: NORTH", newState, "Left action sucessful - from east to north");
        }
예제 #23
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");
        }
예제 #24
0
        public void TestPlace_1()
        {
            var mock = new Mock <IActionValidator>();

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

            IActionable robot = new TableRobot(mock.Object);

            var originalState = robot.ToString();

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

            var newState = robot.ToString();

            Assert.AreNotEqual(originalState, newState, "Place action is successfull when validation is passed");
            Assert.AreEqual("X: 5,  Y: 5,  Facing: EAST", newState, "Place action is successfull when validation is passed");
        }
예제 #25
0
        public void TestRight_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(0, 0, Facing.SOUTH);

            robot.Right();

            var newState = robot.ToString();

            Assert.AreEqual("X: 0,  Y: 0,  Facing: WEST", newState, "Right action sucessful - from south to west");
        }
예제 #26
0
        public void TestCanAction_5()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            Assert.AreEqual(false, robot.CanAction(ActionType.REPORT), "Report action cannot be taken before the robot gets placed onto the table.");
        }
예제 #27
0
        public void TestCanAction_1()
        {
            IActionable robot = new TableRobot(new FiveByFiveTableActionValidator());

            Assert.AreEqual(true, robot.CanAction(ActionType.PLACE), "Place action can always be taken.");
        }