Ejemplo n.º 1
0
 public LancamentoController(ILancamentoService lancamentoService, IAlocacaoService alocacaoService, IProfissionalService profissionalService)
 {
     _lancamentoService   = lancamentoService;
     _alocacaoService     = alocacaoService;
     _profissionalService = profissionalService;
     _lancamentoMapper    = new AutoMapperLancamento();
     _profissionalMapper  = new AutoMapperProfissional();
     _edicaoMapper        = new AutoMapperLancamentoEdicao();
 }
 public LancamentosController(
     ILancamentoService lancamentoService,
     IMapper mapper,
     INotifier notifier,
     ILogger <LancamentosController> logger) : base(notifier)
 {
     _lancamentoService = lancamentoService;
     _mapper            = mapper;
     _logger            = logger;
 }
Ejemplo n.º 3
0
 public LancamentoTest()
 {
     _lancamentoRepository = Substitute.For <ILancamentoRepository>();
     _contaRepository      = Substitute.For <IContaRepository>();
     _contaService         = new ContaService(_contaRepository);
     _lancamentoService    = new LancamentoService(_lancamentoRepository, _contaService);
     _lancamentoApp        = new LancamentoAppService(_lancamentoService);
     _cancellationToken    = new CancellationToken();
     SetupRepository();
 }
Ejemplo n.º 4
0
        public async Task QuandoExecutarGetPost()
        {
            _serviceMock = new Mock <ILancamentoService>();
            _serviceMock.Setup(m => m.Post(lancamentoDtoCreate)).ReturnsAsync(lancamentoDtoCreateResult);
            _service = _serviceMock.Object;

            var result = await _service.Post(lancamentoDtoCreate);

            Assert.NotNull(result);
            Assert.Equal(ContaId, result.ContaId);
            Assert.Equal(Value, result.Value);
        }
Ejemplo n.º 5
0
        public OperacaoService(IContaService contaService, ILancamentoService lancamentoService)
        {
            _contaService      = contaService;
            _lancamentoService = lancamentoService;

            try
            {
                Mapper.Initialize(cfg => {
                    cfg.CreateMap <Conta, ContaArgument>();
                    cfg.CreateMap <Operacao, OperacaoArgument>();
                });
            }
            catch (System.Exception)
            {
            }
        }
Ejemplo n.º 6
0
        public async Task QuandoExecutarGet()
        {
            _serviceMock = new Mock <ILancamentoService>();
            _serviceMock.Setup(m => m.Get(Id)).ReturnsAsync(lancamentoDto);
            _service = _serviceMock.Object;

            var result = await _service.Get(Id);

            Assert.NotNull(result);
            Assert.True(result.Id == Id);
            Assert.Equal(ContaId, result.ContaId);
            Assert.Equal(Description, result.Description);

            _serviceMock = new Mock <ILancamentoService>();
            _serviceMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(Task.FromResult((LancamentoDto)null));
            _service = _serviceMock.Object;

            var _record = await _service.Get(Id);

            Assert.Null(_record);
        }
Ejemplo n.º 7
0
        public MainTest()
        {
            try
            {
                Mapper.Initialize(cfg =>
                {
                    cfg.CreateMap <Conta, ContaArgument>();
                    cfg.CreateMap <Operacao, OperacaoArgument>();
                });
            }
            catch (InvalidOperationException)
            {
                //Mapper já inicializado!!! Segue a vida!
            }

            _lancamentoRepository = new LancamentoRepository();
            _contaService         = new ContaService();
            _lancamentoService    = new LancamentoService(_contaService, _lancamentoRepository);


            //CRIA AS CONTAS E GERA UM SALDO INICIAL PARA TESTE
            _dadosContaOrigem  = CriaConta("Santander", 2300, 10000001, 1, TipoConta.Corrente, 1000);
            _dadosContaDestino = CriaConta("Santander", 2300, 20000002, 3, TipoConta.Corrente, 1500);
        }
Ejemplo n.º 8
0
        public LancamentoTest()
        {
            _lancamentoMock = new Mock <ILancamentoRepository>();

            _lancamentoService = new LancamentoService(_lancamentoMock.Object);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// classe controladora de cliente
 /// </summary>
 /// <param name="lancamentoService">instância de serviços de lançamento</param>
 public LancamentoController(ILancamentoService lancamentoService)
 {
     this.lancamentoService = lancamentoService;
 }
Ejemplo n.º 10
0
 public LancamentoController(Notification notification, ILancamentoRepository lancamentoRepository, ILancamentoService lancamentoService)
 {
     _notification         = notification;
     _lancamentoRepository = lancamentoRepository;
     _lancamentoService    = lancamentoService;
 }