예제 #1
0
        public void Movement_InvalidInitialDirectionCommand_ThrowEx()
        {
            //arrange
            var sut = new RobotService();

            sut.Compute("PLACE 1,2,DEEP");

            //act
            Action act = () => sut.Movement();

            //assert
            act.ShouldThrow <Exception>();
        }
예제 #2
0
        public void Movement_InvalidNumberY_ThrowEx()
        {
            //arrange
            var sut = new RobotService();

            sut.Compute("PLACE 2,X,EAST");

            //act
            Action act = () => sut.Movement();

            //assert
            act.ShouldThrow <Exception>();
        }
예제 #3
0
        public void Movement_ValidMoveResultCommand1_ResultValid()
        {
            //arrange
            var sut = new RobotService();

            sut.Compute("PLACE 1,1,NORTH");
            sut.Compute("MOVE");
            sut.Compute("MOVE");

            //act
            var result = sut.Movement();

            //assert
            Assert.AreEqual(result.AxisX, 1);
            Assert.AreEqual(result.AxisY, 3);
            Assert.AreEqual(result.Facing, "NORTH");
        }
예제 #4
0
        public void Movement_ValidMoveResultCommand3_ResultValid()
        {
            //arrange
            var sut = new RobotService();

            sut.Compute("PLACE 1,2,EAST");
            sut.Compute("MOVE");
            sut.Compute("MOVE");
            sut.Compute("LEFT");
            sut.Compute("LEFT");
            sut.Compute("MOVE");

            //act
            var result = sut.Movement();

            //assert
            Assert.AreEqual(result.AxisX, 2);
            Assert.AreEqual(result.AxisY, 2);
            Assert.AreEqual(result.Facing, "WEST");
        }