protected override void Context() { base.Context(); _createCustomerRequest = Builder<CreateCustomerRequest>.CreateNew().Build(); AuthorizationService.Stub( x => x.CanExecute(Arg<string>.Is.Equal(Username), Arg<Type>.Is.Equal(typeof (CreateCustomerRequest)))). Return(true); CreateCustomerRequestValidator.Stub( x => x.Validate(Arg<CreateCustomerRequest>.Is.Equal(_createCustomerRequest))) .Return(new ValidationResult()); CustomerRepository.Stub(x => x.NameExists(Arg<string>.Is.Equal(_createCustomerRequest.Name))) .Return(false); CustomerRepository.Stub( x => x.Create(Arg<CreateCustomerRequest>.Is.Equal(_createCustomerRequest))); _expectedResponse = new CreateCustomerResponse { Success = true, }; }
protected override void Context() { base.Context(); _createCustomerRequest = Builder<CreateCustomerRequest>.CreateNew().Build(); AuthorizationService.Stub( x => x.CanExecute(Arg<string>.Is.Equal(Username), Arg<Type>.Is.Equal(typeof (CreateCustomerRequest)))). Return(false); _expectedResponse = new CreateCustomerResponse(new List<string> { "User is not authorized to Create Franchise", }) { Success = false, }; }
protected override void Context() { base.Context(); _createCustomerRequest = Builder<CreateCustomerRequest>.CreateNew().Build(); AuthorizationService.Stub( x => x.CanExecute(Arg<string>.Is.Equal(Username), Arg<Type>.Is.Equal(typeof (CreateCustomerRequest)))). Return(true); _validationResponse = new ValidationResult(new List<ValidationFailure> { new ValidationFailure("some property", "some error") }); CreateCustomerRequestValidator.Stub( x => x.Validate(Arg<CreateCustomerRequest>.Is.Equal(_createCustomerRequest))) .Return(_validationResponse); _expectedResponse = new CreateCustomerResponse(_validationResponse.Errors.Select(x => x.ErrorMessage)) { Success = false, }; }
protected override void BecauseOf() { _response = CustomerCreator.Execute(Username, _createCustomerRequest); }