예제 #1
0
        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.");
        }
예제 #2
0
        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.");
        }