public void Should_map_the_data_from_the_view_to_the_dto(long customerId, string userName, string password,
                                                                 string firstName,
                                                                 string lastName, string phone, string city)
        {
            using (mockery.Record( )) {
                SetupResult.For(mockRequest.ParsePayloadFor(PayloadKeys.CustomerId)).Return(customerId);
                SetupResult.For(mockRequest.ParsePayloadFor(Create("uxUserNameTextBox"))).Return(userName);
                SetupResult.For(mockRequest.ParsePayloadFor(Create("uxPasswordTextBox"))).Return(password);
                SetupResult.For(mockRequest.ParsePayloadFor(Create("uxFirstNameTextBox"))).Return(firstName);
                SetupResult.For(mockRequest.ParsePayloadFor(Create("uxLastNameTextBox"))).Return(lastName);
                SetupResult.For(mockRequest.ParsePayloadFor(Create("uxPhoneNumberTextBox"))).Return(phone);
                SetupResult.For(mockRequest.ParsePayloadFor(Create("uxCityTextBox"))).Return(city);
            }

            using (mockery.Playback( )) {
                UpdateCustomerRegistrationDTO dto = CreateSUT( ).MapFrom(mockRequest);
                Assert.AreEqual(customerId, dto.CustomerId);
                Assert.AreEqual(userName, dto.Username);
                Assert.AreEqual(password, dto.Password);
                Assert.AreEqual(firstName, dto.FirstName);
                Assert.AreEqual(lastName, dto.LastName);
                Assert.AreEqual(phone, dto.PhoneNumber);
                Assert.AreEqual(city, dto.City);
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <DisplayResponseLineDTO> UpdateRegistrationFor(UpdateCustomerRegistrationDTO registration)
        {
            ICustomer customer = _customers.FindBy(registration.CustomerId);

            customer.UpdateRegistrationTo(registration.Username, registration.Password, registration.FirstName,
                                          registration.LastName, registration.PhoneNumber, registration.City);
            if (customer.Registration( ).IsValid( ))
            {
                _customers.Save(customer);
            }
            return(_mapper.MapFrom(customer.Registration( ).BrokenRules( )));
        }
        public void Should_leverage_task_to_submit_changed_registration_information( )
        {
            UpdateCustomerRegistrationDTO customer = ObjectMother.UpdateCustomerRegistrationDTO( );

            using (mockery.Record( )) {
                SetupResult.For(mockMapper.MapFrom(mockRequest)).Return(customer);
                Expect.Call(mockTask.UpdateRegistrationFor(customer)).Return(null);
            }

            using (mockery.Playback( )) {
                CreateSUT( ).UpdateRegistration( );
            }
        }
Ejemplo n.º 4
0
 public IEnumerable <DisplayResponseLineDTO> UpdateRegistrationFor(UpdateCustomerRegistrationDTO registration)
 {
     return(_underlyingTask.UpdateRegistrationFor(registration));
 }