public void ReturnLeaderBoardForVehicleType(Vehicle vehicle1, Vehicle vehicle2, Vehicle vehicle3, VehicleType vehicleType) { var vehicles = RaceBuilder.BuildWithVehicles(vehicle1, vehicle2, vehicle3).LeaderBoardForVehicleType(vehicleType); var vehiclesAllTheSameType = vehicles.All(v => v.Type.Equals(vehicleType)); vehiclesAllTheSameType.Should().BeTrue(); }
public void FindVehiclesByModelAndStatus(string model, string vehicleStatus) { var vehicle1 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Koksha", "187", VehicleStatus.Pending); var vehicle2 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Nino", "187", VehicleStatus.Pending); var vehicles = RaceBuilder.BuildWithVehicles(vehicle1, vehicle2).FindVehicleBy(string.Empty, model, vehicleStatus); vehicles.Should().HaveCount(2); }
public void ReturnAllVehiclesLeaderBoard(Vehicle vehicle1, Vehicle vehicle2, Vehicle vehicle3) { var vehicles = RaceBuilder.BuildWithVehicles(vehicle1, vehicle2, vehicle3).AllVehiclesLeaderBoard(); vehicles.Should().HaveCount(3); vehicles.Should().Contain(vehicle1); vehicles.Should().Contain(vehicle2); vehicles.Should().Contain(vehicle3); }
public void ThrowExceptionIfTheTeamNameIsAlreadyTakenWhenAddingNewCarToTheRace() { var vehicle = VehicleBuilder.Build(); var vehicleToAdd = VehicleBuilder.BuildUpsertVehicleWithId(vehicle.Id); var race = RaceBuilder.BuildWithVehicles(vehicle); Exception ex = Assert.Throws <Exception>(() => race.AddVehicle(vehicleToAdd)); ex.Message.Should().Be($"Team name '{vehicleToAdd.TeamName}' is already taken."); }
public void FindVehiclesByStatus(string vehicleStatus) { var vehicle1 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Koksha", "Peugeot", VehicleStatus.Pending); var vehicle2 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Nino", "Subaru", VehicleStatus.Pending); var vehicle3 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Tibika", "Citroen", VehicleStatus.Running); var vehicles = RaceBuilder.BuildWithVehicles(vehicle1, vehicle2).FindVehicleBy(string.Empty, string.Empty, vehicleStatus); vehicles.Should().HaveCount(2); }
public void FindOneVehicleWhenAllThreeSearchParametersAreEntered(string teamName, string model, string vehicleStatus) { var vehicle1 = VehicleBuilder.Build(); var vehicle2 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Koksha", "187", VehicleStatus.Pending); var vehicle3 = VehicleBuilder.BuildWithTeamNameAndModelAndStatus("Nino", "187", VehicleStatus.Pending); var vehicles = RaceBuilder.BuildWithVehicles(vehicle1, vehicle2, vehicle3).FindVehicleBy(teamName, model, vehicleStatus); vehicles.Should().HaveCount(1); }
public void ThrowExceptionIfTheTeamNameIsAlreadyTakenWhileTryingToUpdateVehicleInfo() { var vehicle = VehicleBuilder.Build(); var vehicleToUpdate = VehicleBuilder.BuildUpsertVehicleWithId(vehicle.Id); var race = RaceBuilder.BuildWithVehicles(vehicle); Exception ex = Assert.Throws <Exception>(() => race.UpdateVehicleInfo(vehicleToUpdate)); ex.Message.Should().Be($"Team name '{vehicleToUpdate.TeamName}' is already taken."); }
public void ReturnVehicleStatistics() { var vehicle = VehicleBuilder.Build(); var vehicle2 = VehicleBuilder.BuildWithVehicleStatusAndDistanceAndFinishTime(VehicleStatus.Finished, 250, "20:33"); var vehicleStatistics = RaceBuilder.BuildWithVehicles(vehicle, vehicle2).VehicleStatisticsBy(vehicle.Id); vehicleStatistics.Distance.Should().Be(vehicle.Distance); vehicleStatistics.Status.Should().Be(vehicle.Status); vehicleStatistics.FinishTime.Should().Be(vehicle.FinishTime); }
public void StartRace() { var checkRaceProgressionInSeconds = 10; var vehicle = VehicleBuilder.Build(); var vehicle2 = VehicleBuilder.Build(); var race = RaceBuilder.BuildWithVehicles(vehicle, vehicle2).StartRace(checkRaceProgressionInSeconds); var vehiclesStatusIsNotPending = race.Vehicles.All(v => v.Status != VehicleStatus.Pending); race.Status.Should().NotBe(RaceStatusType.Pending); race.Vehicles.Should().NotBeEmpty(); vehiclesStatusIsNotPending.Should().BeTrue(); }