protected override void Context()
        {
            AuthorizationService = MockRepository.GenerateStub<IAuthorizationService>();
            CreateCustomerRequestValidator = MockRepository.GenerateStub<CreateCustomerRequestValidator>();
            ValidatorFactory = MockRepository.GenerateStub<IValidatorFactory>();
            ValidatorFactory.Stub(x => x.GetValidator<CreateCustomerRequest>())
                .Return(CreateCustomerRequestValidator);
            CustomerRepository = MockRepository.GenerateStub<ICustomerRepository>();

            CustomerCreator = new CustomerCreator(AuthorizationService, CreateCustomerRequestValidator, CustomerRepository);
        }
Exemplo n.º 2
0
        public CustomerController(ILogger logger, IAuthorizationService authorizationService,
                                  IValidatorFactory validatorFactory, ICustomerRepository customerRepository,
                                  IMappingEngine mappingEngine, ICustomerCreator customerCreator, IAccountRepository accountRepository)
        {
            _authorizationService = authorizationService;
            _validatorFactory = validatorFactory;
            _customerRepository = customerRepository;
            _mappingEngine = mappingEngine;
            _customerCreator = customerCreator;
            _accountRepository = accountRepository;

            _logger = logger;
        }
        protected override void Context()
        {
            CustomerService = MockRepository.GenerateStub<ICustomerService>();
            Logger = MockRepository.GenerateStub<ILogger>();

            _user = new FakePrincipal(new FakeIdentity(Username), null);
            HttpRequest = MockRepository.GenerateStub<HttpRequestBase>();
            HttpContext = MockRepository.GenerateStub<HttpContextBase>();
            HttpContext.Stub(x => x.Request).Return(HttpRequest);
            HttpContext.User = _user;
            MappingEngine = MockRepository.GenerateStub<IMappingEngine>();
            CustomerCreator = MockRepository.GenerateStub<ICustomerCreator>();

            CustomerController = new CustomerController(Logger, null, null, null, MappingEngine, CustomerCreator, null);

            CustomerController.ControllerContext = new ControllerContext(HttpContext, new RouteData(),
                                                                         CustomerController);
        }