コード例 #1
0
ファイル: RaceTestShould.cs プロジェクト: Ninchuga/DakarRally
        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.");
        }
コード例 #2
0
ファイル: RaceTestShould.cs プロジェクト: Ninchuga/DakarRally
        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.");
        }