Ejemplo n.º 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>();
        }
Ejemplo n.º 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>();
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }