예제 #1
0
        public async void RegisterValidKnownVehicle_ShouldReturnObjectThatHaveNotEmptyKnownVehicleId()
        {
            var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest();
            var registration = await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest);

            registration.VehicleId.Should().NotBeEmpty();
        }
예제 #2
0
        public async void RegisterValidKnownVehicle_ShouldReturnOfTypeVehicleRegistered()
        {
            var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest();

            var registration = await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest);

            registration.Should().BeOfType <VehicleRegistered>();
        }
예제 #3
0
        public async Task <IActionResult> Register([FromBody] Dtos.In.VehicleRegistrationRequest vehicleRegistrationRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            return(await ProcessResponse(() => RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest)));
        }
예제 #4
0
        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");
        }
예제 #5
0
        public void RegisterVehicleWithEmptyPlate_ShouldThrowException()
        {
            var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest();

            vehicleRegistrationRequest.Plate = string.Empty;

            Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest);

            action.Should().Throw <AppArgumentException>();
        }
예제 #6
0
        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>();
        }
예제 #7
0
        public void RegisterVehicleWithNullAccountableUserId_ShouldThrowException()
        {
            var vehicleRegistrationRequest = CreateValidVehicleRegistrationRequest();

            vehicleRegistrationRequest.UserId = null;

            Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(vehicleRegistrationRequest);

            action.Should().Throw <AppArgumentException>();
        }
예제 #8
0
        public void RegisterNullVehicle_ShouldThrowException()
        {
            Func <Task <VehicleRegistered> > action = async() => await RegisterKnownVehicleUseCase.Register(null);

            action.Should().Throw <AppArgumentException>();
        }