public void ThrowExceptionIfTheRaceIsRunningAndVehicleIsTryingToBeRemovedFromTheRace() { var vehicle = VehicleBuilder.BuildWithRunningStatus(); var race = RaceBuilder.BuildWithVehicleAndRunningStatus(vehicle); Exception ex = Assert.Throws <Exception>(() => race.RemoveVehicleBy(vehicle.Id)); ex.Message.Should().Be("Vehicle cannot be removed from the race while the race is running."); }
public void ThrowExceptionIfTheRaceIsRunningAndVehicleIsTryingToBeUpdated() { var vehicle = VehicleBuilder.BuildWithRunningStatus(); var updatedVehicle = VehicleBuilder.BuildUpsertVehicleWithIdAndTeamNameAndModel(vehicle.Id, "UpdatedTeamName", "UpdatedModel"); var race = RaceBuilder.BuildWithVehicleAndRunningStatus(vehicle); Exception ex = Assert.Throws <Exception>(() => race.UpdateVehicleInfo(updatedVehicle)); ex.Message.Should().Be("Cannot update vehicle info while the race is running."); }