public async void RegisterValidKnownVehicle_ShouldReturnObjectThatHaveNotEmptyKnownVehicleId() { var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest(); var registration = await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest); registration.VehicleId.Should().NotBeEmpty(); }
public async void RegisterValidKnownVehicle_ShouldReturnOfTypeVehicleRegistered() { var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest(); var registration = await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest); registration.Should().BeOfType <VehicleRegistered>(); }
public async Task <IActionResult> Register([FromBody] Dtos.In.VehicleRegistrationRequest vehicleRegistrationRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(await ProcessResponse(() => RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest))); }
public async void RegisterValidKnownVehicle_ShouldReturnObjectThatHavePropertyVehicleId() { var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest(); var registration = await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest); var properties = registration.GetType().GetProperties(); properties.Should().Contain(p => p.Name == "VehicleId"); }
public void RegisterVehicleWithEmptyPlate_ShouldThrowException() { var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest(); vehicleRegistrationRequest.Plate = string.Empty; Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest); action.Should().Throw <AppArgumentException>(); }
public void RegisterVehicleWithNonExistentAccountableUserId_ShouldThrowException() { var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest(); vehicleRegistrationRequest.UserId = Guid.Parse(NonExistentUserId); Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest); action.Should().Throw <AppNotFoundException>(); }
public void RegisterVehicleWithNullAccountableUserId_ShouldThrowException() { var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest(); vehicleRegistrationRequest.UserId = null; Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest); action.Should().Throw <AppArgumentException>(); }
public void RegisterNullVehicle_ShouldThrowException() { Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(null); action.Should().Throw <AppArgumentException>(); }