public TipoPlanoControllerTest() { var options = new DbContextOptionsBuilder <PlanoDBContext>() .UseInMemoryDatabase(databaseName: "TipoPlanoTeste").Options; var context = new PlanoDBContext(options); if (!context.TiposPlanos.Any()) { context.TiposPlanos.Add(new TipoPlano { Nome = "Pos" }); context.TiposPlanos.Add(new TipoPlano { Nome = "Controle" }); context.TiposPlanos.Add(new TipoPlano { Nome = "Pre" }); context.SaveChanges(); } _contextTest = context; var _repo = new TipoPlanoRepository(context); _controller = new TipoPlanoController(_repo); }
public DDDControllerTest() { var options = new DbContextOptionsBuilder <PlanoDBContext>() .UseInMemoryDatabase(databaseName: "DDDTeste").Options; var context = new PlanoDBContext(options); if (!context.DDDs.Any()) { context.DDDs.Add(new DDD { Codigo = "021" }); context.DDDs.Add(new DDD { Codigo = "011" }); context.DDDs.Add(new DDD { Codigo = "031" }); context.SaveChanges(); } _contextTest = context; var _repo = new DDDRepository(context); _controller = new DDDController(_repo); }
public OperadoraControllerTest() { var options = new DbContextOptionsBuilder <PlanoDBContext>() .UseInMemoryDatabase(databaseName: "OperadoraTeste").Options; var context = new PlanoDBContext(options); if (!context.Operadoras.Any()) { context.Operadoras.Add(new Operadora { Nome = "Vivo" }); context.Operadoras.Add(new Operadora { Nome = "Tim" }); context.Operadoras.Add(new Operadora { Nome = "Claro" }); context.SaveChanges(); } _contextTest = context; var _repo = new OperadoraRepository(context); _controller = new OperadoraController(_repo); }
public PlanoControllerTest() { var options = new DbContextOptionsBuilder <PlanoDBContext>() .UseInMemoryDatabase(databaseName: "PlanosDB").Options; var context = new PlanoDBContext(options); if (!context.Planos.Any()) { CargaTeste.Populate(ref context); } _contextTest = context; var _repo = new PlanoRepository(context); _controller = new PlanoController(_repo, context); }
public DDDRepository(PlanoDBContext ctx) { _context = ctx; }
public OperadoraRepository(PlanoDBContext ctx) { _context = ctx; }
public TipoPlanoRepository(PlanoDBContext ctx) { _context = ctx; }
public PlanoController(IPlanoRepository planoRepository, PlanoDBContext ctx) { _planoRepository = planoRepository; _context = ctx; }