protected FitCardContext GetInMemoryDBContext() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkSqlServer() .BuildServiceProvider(); var builder = new DbContextOptionsBuilder <FitCardContext>(); var options = builder.UseSqlServer(connectionString) .UseInternalServiceProvider(serviceProvider) .Options; FitCardContext dbContext = new FitCardContext(options); dbContext.Database.EnsureDeleted(); dbContext.Database.EnsureCreated(); return(dbContext); }
public void Seed(FitCardContext context) { context.Categoria.Add(new CategoriaEntity { CategoriaNome = "Supermercado" }); context.Categoria.Add(new CategoriaEntity { CategoriaNome = "Restaurante" }); context.Categoria.Add(new CategoriaEntity { CategoriaNome = "Borracharia" }); context.Categoria.Add(new CategoriaEntity { CategoriaNome = "Posto" }); context.Categoria.Add(new CategoriaEntity { CategoriaNome = "Oficina" }); context.SaveChanges(); context.User.Add(new UserEntity { Nome = "FitCard", Email = "*****@*****.**" }); context.SaveChanges(); }
public BaseTest(FitCardContext ctx = null) { this.ctx = ctx ?? GetInMemoryDBContext(); }
public CategoriaImplementation(FitCardContext context) : base(context) { _dataset = context.Set <CategoriaEntity>(); }
public EmpresaImplementation(FitCardContext context) : base(context) { _dataset = context.Set <EmpresaEntity>(); }
public BaseRepository(FitCardContext context) { _context = context; _dataset = _context.Set <T>(); }
public UserImplementation(FitCardContext context) : base(context) { _dataset = context.Set <UserEntity>(); }