public void Setup() { config = new DbContextOptionsBuilder <SportNewsContext>() .UseInMemoryDatabase(databaseName: "SportNews Test").Options; context = new SportNewsContext(config); context.Set <WCategory>().Add(new WCategory { Name = "test" }); context.Set <Category>().Add(new Category { Name = "test" }); context.Set <Role>().Add(new Role { NameRole = "testRole" }); context.SaveChanges(); unitOfWork = new UnitOfWork(context); }
public async Task Add(T model) { await _SportNewsContext.Set <T>().AddAsync(model); }