public void Movement_InvalidMovementCommand_ThrowEx() { //arrange var sut = new RobotService(); sut.Compute("PLACE 1,2,NORTH"); //act Action act = () => sut.Compute("STAY"); //assert act.ShouldThrow <Exception>(); }
public void Movement_InvalidNumberX_InMiddle_ThrowEx() { //arrange var sut = new RobotService(); sut.Compute("PLACE 2,2,EAST"); sut.Compute("MOVE"); sut.Compute("PLACE x,2,EAST"); //act Action act = () => sut.Movement(); //assert act.ShouldThrow <Exception>(); }
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"); }
public void Movement_InvalidPlaceCommand_ThrowEx() { //arrange var sut = new RobotService(); //act Action act = () => sut.Compute("NO_COMMAND 1,2,EAST"); //assert act.ShouldThrow <Exception>(); }
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>(); }
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"); }