public void Initialize()
        {
            var builder = new DbContextOptionsBuilder <alugaiContext>();

            builder.UseInMemoryDatabase("alugai");
            var options = builder.Options;

            _context = new alugaiContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            var statuspagamentos = new List <Statuspagamento>
            {
                new Statuspagamento {
                    CodigoStatusPagamento = 1, Descricao = "Pago"
                },

                new Statuspagamento {
                    CodigoStatusPagamento = 2, Descricao = "Atrazado"
                },
            };

            _context.AddRange(statuspagamentos);
            _context.SaveChanges();

            _statuspagamentoService = new StatuspagamentoService(_context);
        }
示例#2
0
 public AluguelController(IAluguelService aluguelService,
                          IStatuspagamentoService statuspagamentoService, IMapper mapper)
 {
     _aluguelService         = aluguelService;
     _statusPagamentoService = statuspagamentoService;
     _mapper = mapper;
 }
 public StatuspagamentoController(IStatuspagamentoService statuspagamentoService, IMapper mapper)
 {
     _statuspagamentoService = statuspagamentoService;
     _mapper = mapper;
 }