コード例 #1
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");
        }
コード例 #2
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");
        }
コード例 #3
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");
        }
コード例 #4
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");
        }