public ERPContextFactory() { DbContextOptions <ERPContext> contextOptions = new DbContextOptionsBuilder <ERPContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .EnableSensitiveDataLogging() .Options; EnsureCreation(contextOptions); ContextInstance = new TestERPContext(contextOptions); GenreMapper = new GenreMapper(); ArtistMapper = new ArtistMapper(); ItemMapper = new ItemMapper(ArtistMapper, GenreMapper); }
private void EnsureCreation(DbContextOptions <ERPContext> contextOptions) { using TestERPContext context = new TestERPContext(contextOptions); context.Database.EnsureCreated(); }