public SearchTests() { // Use a clean instance of the context to run the test var options = new DbContextOptionsBuilder <EmplyeeDbConext>() .UseInMemoryDatabase(databaseName: $"Clarkson.Empoyees.{Guid.NewGuid().ToString()}") .Options; var conext = new EmplyeeDbConext(options); _manager = new EmployeeManager(conext); }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new EmplyeeDbConext( serviceProvider.GetRequiredService <DbContextOptions <EmplyeeDbConext> >())) { // Look for any board games. if (context.Employee.Any()) { return; // Data was already seeded } var employees = EmployeeSeed.Data(); context.Employee.AddRange(employees); context.SaveChanges(); } }
public EmployeeManager(EmplyeeDbConext conext) { _conext = conext; }