protected override void Context()
        {
            Username = "******";
            base.Context();

            _createCustomerInputModel = Builder<CreateCustomerInputModel>.CreateNew().Build();
            _createCustomerRequestReturnedFromMappingEngine = new CreateCustomerRequest
                                                                  {
                                                                      CustomerType = _createCustomerInputModel.CustomerType,
                                                                      FacebookUrl = _createCustomerInputModel.FacebookUrl,
                                                                      GooglePlacesUrl = _createCustomerInputModel.GooglePlacesUrl,
                                                                      ListName = _createCustomerInputModel.ListName,
                                                                      Name = _createCustomerInputModel.Name,
                                                                      ParentCustomerId = _createCustomerInputModel.ParentCustomerId,
                                                                      Phone = _createCustomerInputModel.Phone,
                                                                      TwitterHandle = _createCustomerInputModel.TwitterHandle,
                                                                      WebsiteUrl = _createCustomerInputModel.WebsiteUrl,
                                                                      MailingAddress = new Address
                                                                                           {
                                                                                               City = _createCustomerInputModel.City,
                                                                                               State = _createCustomerInputModel.State,
                                                                                               Street = _createCustomerInputModel.Street,
                                                                                               AdditionalInfo = _createCustomerInputModel.AdditionalInfo,
                                                                                               Zipcode = _createCustomerInputModel.Zipcode,
                                                                                           },
                                                                  };

            MappingEngine.Stub(
                x =>
                x.Map<CreateCustomerInputModel, CreateCustomerRequest>(
                    Arg<CreateCustomerInputModel>.Is.Equal(_createCustomerInputModel)))
                .Return(_createCustomerRequestReturnedFromMappingEngine);

            _contactReturnedFromMappingEngine = new Contact
                                                    {
                                                        Email = _createCustomerInputModel.ContactEmail,
                                                        FirstName = _createCustomerInputModel.ContactFirstName,
                                                        IsPrimary = true,
                                                        LastName = _createCustomerInputModel.ContactLastName,
                                                        Phone = _createCustomerInputModel.ContactPhone,
                                                    };
            MappingEngine.Stub(
                x =>
                x.Map<CreateCustomerInputModel, Contact>(
                    Arg<CreateCustomerInputModel>.Is.Equal(_createCustomerInputModel)))
                .Return(_contactReturnedFromMappingEngine);

            CustomerCreator.Stub(
                x => x.Execute(Arg<string>.Is.Equal(Username), Arg<CreateCustomerRequest>.Is.Equal(_createCustomerRequestReturnedFromMappingEngine)))
                .WhenCalled(x => _requestPassedToCustomerService = x.Arguments[1] as CreateCustomerRequest)
                .Return(new CreateCustomerResponse
                            {
                                Success = true,
                            });

            _expectedRequest = new CreateCustomerRequest
                                   {
                                       Name = _createCustomerInputModel.Name,
                                       Phone = _createCustomerInputModel.Phone,
                                       MailingAddress = new Address
                                                            {
                                                                Street = _createCustomerInputModel.Street,
                                                                AdditionalInfo =
                                                                    _createCustomerInputModel.AdditionalInfo,
                                                                City = _createCustomerInputModel.City,
                                                                State = _createCustomerInputModel.State,
                                                                Zipcode = _createCustomerInputModel.Zipcode,
                                                            },
                                       CustomerType = _createCustomerInputModel.CustomerType,
                                       ListName = _createCustomerInputModel.ListName,
                                       TwitterHandle = _createCustomerInputModel.TwitterHandle,
                                       GooglePlacesUrl = _createCustomerInputModel.GooglePlacesUrl,
                                       WebsiteUrl = _createCustomerInputModel.WebsiteUrl,
                                       ParentCustomerId = _createCustomerInputModel.ParentCustomerId,
                                       FacebookUrl = _createCustomerInputModel.FacebookUrl
                                   };

            _expectedRequest.AddContact(new Contact
                                            {
                                                FirstName = _createCustomerInputModel.ContactFirstName,
                                                LastName = _createCustomerInputModel.ContactLastName,
                                                Phone = _createCustomerInputModel.ContactPhone,
                                                Email = _createCustomerInputModel.ContactEmail,
                                                IsPrimary = true,
                                            });
        }
Пример #2
0
 public void AddContact(Contact contact)
 {
     _contacts.Add(contact);
 }