public void SetUp() { _checkingAccount = ObjectMother.GetCheckingAccountValid(); _mockRepositoryAccount = new Mock <ICheckingAccountRepository>(); _mockRepositoryClient = new Mock <IClientRepository>(); _service = new CheckingAccountService(_mockRepositoryAccount.Object, _mockRepositoryClient.Object); }
public CheckingAccountApplicationService( IMapper mapper, ICheckingAccountService checkingAccountService) { _checkingAccountService = checkingAccountService; _mapper = mapper; }
public PaymentApplicationService( IMapper mapper, IPaymentService paymentService, ICheckingAccountService checkingAccountService) { _paymentService = paymentService; _mapper = mapper; _checkingAccountService = checkingAccountService; }
public CheckingAccountsController() : base() { var context = new BankContext(); var repository = new CheckingAccountRepository(context); var repositoryClient = new ClientRepository(context); var repositoryTransaction = new TransactionRepository(context); _accountsService = new CheckingAccountService(repository, repositoryClient, repositoryTransaction); }
public TransferValidator(ICheckingAccountService checkingAccountService) { RuleFor(transfer => transfer.NumberFrom) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty() .NotNull() .Must(number => number > 0) .WithMessage("Número de conta origem inválido"); RuleFor(transfer => transfer.NumberTo) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty() .NotNull() .Must(number => number > 0) .WithMessage("Número de conta destino inválido"); RuleFor(transfer => transfer.NumberFrom) .Cascade(CascadeMode.StopOnFirstFailure) .NotEqual(t => t.NumberTo) .WithMessage("Conta origem e conta destino devem ser diferentes"); RuleFor(transfer => transfer.Amount) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty() .NotNull() .Must(number => number > 0) .WithMessage("Valor de transferência deve ser maior que zero"); RuleFor(transfer => transfer) .Cascade(CascadeMode.StopOnFirstFailure) .Custom((transfer, context) => { var checkingAccountFrom = checkingAccountService.GetByNumber(transfer.NumberFrom); if (checkingAccountFrom == null) { context.AddFailure("Conta origem não encontrada"); } if (checkingAccountFrom.UserId.ToString() != transfer.UserId) { context.AddFailure("Conta origem não pertence ao usuário logado"); } }); RuleFor(transfer => transfer) .Cascade(CascadeMode.StopOnFirstFailure) .Custom((transfer, context) => { var checkingAccountFrom = checkingAccountService.GetByNumber(transfer.NumberTo); if (checkingAccountFrom == null) { context.AddFailure("Conta destino não encontrada"); } }); }
public void SetUp() { AutoMapperInitializer.Reset(); AutoMapperInitializer.Initialize(); _checkingAccount = ObjectMother.GetCheckingAccountValid(); _checkingAccountRegister = Mapper.Map <CheckingAccountRegisterCommand>(_checkingAccount); _checkingAccountUpdate = Mapper.Map <CheckingAccountUpdateCommand>(_checkingAccount); _checkingAccountRemove = Mapper.Map <CheckingAccountRemoveCommand>(_checkingAccount); _mockRepositoryAccount = new Mock <ICheckingAccountRepository>(); _mockRepositoryClient = new Mock <IClientRepository>(); _service = new CheckingAccountService(_mockRepositoryAccount.Object, _mockRepositoryClient.Object); }
public TransactionService(ITransactionRepository transactionRepository, ICheckingAccountService checkingAccountService) { _transactionRepository = transactionRepository; _checkingAccountService = checkingAccountService; }
public CheckingAccountsController(ICheckingAccountService checkingAccountService) { _accountsService = checkingAccountService; }
public CheckingAccountService(ICheckingAccountService _checkingAccountService) { _checkingAccountService = checkingAccountService; }
public AccountControllerTest() { _checkingAccountServiceMock = Substitute.For <ICheckingAccountService>(); _checkingAccountController = new AccountController(_checkingAccountServiceMock); }
/// <summary> /// Constructor /// </summary> public CheckingAccountController(ICheckingAccountRepository checkingAccountRepository, ICheckingAccountService checkingAccountService, IMapper mapper) { _checkingAccountRepository = checkingAccountRepository; _checkingAccountService = checkingAccountService; _mapper = mapper; }
public TransactionApplication(ICheckingAccountService checkingAccountService, ITransactionService transactionService) { _checkingAccountService = checkingAccountService; _transactionService = transactionService; }
public CheckingAccountApplication(ICheckingAccountService checkingAccountService) { _checkingAccountService = checkingAccountService; }
public AccountController(ICheckingAccountService checkingAccountService) { _checkingAccountService = checkingAccountService; }