public MaterialsServiceTests() { var dbContextOptionsBuilder = new DbContextOptionsBuilder <PertensaDbContext>(); dbContextOptionsBuilder.UseInMemoryDatabase("MockPertensaDB"); inMemoryDbContext = new PertensaDbContext(dbContextOptionsBuilder.Options); SeedMockDatabase(inMemoryDbContext); }
private void SeedMockDatabase(PertensaDbContext inMemoryDbContext) { inMemoryDbContext.Employees.AddRangeAsync(new Employee[] { new Employee() { FirstName = "First", MiddleName = "Middle", LastName = "Last" }, }); inMemoryDbContext.SaveChanges(); }
public DatabaseService(PertensaDbContext dbContext, RoleManager <Role> roleService, UserManager <User> profileService, IMaterialsService materialsService, IFileService fileService, ILogger <DatabaseService> logger) { this.dbContext = dbContext; this.roleService = roleService; this.profileService = profileService; this.fileService = fileService; this.materialsService = materialsService; this.logger = logger; }
private void SeedMockDatabase(PertensaDbContext inMemoryDbContext) { inMemoryDbContext.Warehouse.AddRangeAsync(new Material[] { new Material(EElement.Ag, EForm.Bars, 100), new Material(EElement.Al, EForm.Slabs, 100) }); inMemoryDbContext.Alloys.AddRangeAsync(new Alloy[] { new Alloy("Ag44.6Al55.4", 1234.56M) }); inMemoryDbContext.SaveChanges(); }
public MessengerService(IOptions <MessengerOptions> options, PertensaDbContext dbContext) { this.options = options; this.dbContext = dbContext; }
public EmployeesService(PertensaDbContext dbContext) { this.dbContext = dbContext; }
public MaterialsService(PertensaDbContext dbContext) { this.dbContext = dbContext; }