public ActionResult Create(CreateCustomerViewModel vm)
        {
            var response = _customerRegistration.RegisterCustomer(vm);

            if (response.Failure)
            {
                FlashMessage.Warning(response.ErrorMessage);
                return(RedirectToAction("Create"));
            }

            FlashMessage.Confirmation("Customer created successfully.");
            return(RedirectToAction("ShowCustomer", new { id = response.Id }));
        }
        public void Registering_a_valid_customer_should_redirect_to_show_customer_with_correct_id()
        {
            // Arrange
            InitHttpContext();
            InitMocks();

            const long customerId = 42;

            _mockedCustomerRegistrationService.RegisterCustomer(_stubbedViewModel)
            .Returns(new CustomerCreatedViewModel(customerId));

            var sut = new HomeController(_mockedCustomerRegistrationService, _stubbedCustomerRepository);

            // Act
            var response = sut.Create(_stubbedViewModel);

            // Assert
            response.Should().BeOfType <RedirectToRouteResult>();
            var redirectToRouteResult = (RedirectToRouteResult)response;

            redirectToRouteResult.RouteValues["action"].Should().Be("ShowCustomer");
            redirectToRouteResult.RouteValues["id"].Should().Be(customerId);
        }