Esempio n. 1
0
        public void RemoveVehicleFromTheRace()
        {
            var vehicle = VehicleBuilder.BuildWithRunningStatus();

            var race = RaceBuilder.BuildWithVehicle(vehicle).RemoveVehicleBy(vehicle.Id);

            race.Vehicles.Should().NotContain(vehicle);
        }
Esempio n. 2
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.");
        }
Esempio n. 3
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.");
        }