Exemple #1
0
 private void Validate(ApiCustomerRegistration customerReg)
 {
     if (customerReg == null)
     {
         throw new MissingCustomerRegistration();
     }
 }
        public async Task When_Call_Register_Then_Delegate_To_UseCase(ApiCustomerRegistration apiReg,
                                                                      CustomerRegistration reg)
        {
            var controller = SetupController();
            await controller.Register(apiReg);

            VerifyCallUseCase(controller, reg);
        }
Exemple #3
0
        public async Task <IHttpActionResult> Register(ApiCustomerRegistration customerReg)
        {
            try
            {
                Validate(customerReg);
                var reg      = customerReg.ToRegistration();
                var customer = await RegisterUseCase.Register(reg);

                return(Ok(customer));
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }
        }
        // TODO: Should really return 201 - Created.
        public async Task Given_UseCase_Returns_Customer_When_Call_Register_Then_Return_200_OK(ApiCustomerRegistration apiReg,
                                                                                               Customer customer)
        {
            var controller = SetupController(customer);
            var result     = await controller.Register(apiReg);

            VerifyOkResult(result, customer);
        }