public TeamServicesTests() { var services = new ServiceCollection(); services.AddDbContext <SuperCharactersAppDbContext>(options => options.UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())); services.AddScoped <TeamServices>(); services.AddScoped <IUnitOfWork, UnitOfWork>(); _serviceProvider = services.BuildServiceProvider(); _dbContext = _serviceProvider.GetService <SuperCharactersAppDbContext>(); _teamServices = _serviceProvider.GetService <TeamServices>(); _unitOfWork = _serviceProvider.GetService <IUnitOfWork>(); Mapper.Reset(); AutoMapperConfig.RegisterMappings( typeof(TeamViewModel).Assembly ); _teamData = TeamDataSeed(); }
public RepositoryGeneric(SuperCharactersAppDbContext dbContext) { _dbContext = dbContext; _dbSet = _dbContext.Set <TEntity>(); }
public UnitOfWork(SuperCharactersAppDbContext dbContext) { _dbContext = dbContext; }