Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 public RepositoryGeneric(SuperCharactersAppDbContext dbContext)
 {
     _dbContext = dbContext;
     _dbSet     = _dbContext.Set <TEntity>();
 }
Exemplo n.º 3
0
 public UnitOfWork(SuperCharactersAppDbContext dbContext)
 {
     _dbContext = dbContext;
 }