public static CBVinilContext Create(ITestSeed seed) { var dbName = Guid.NewGuid().ToString() + DateTime.Now.ToLongTimeString(); var serviceProvider = new ServiceCollection() .AddEntityFrameworkInMemoryDatabase() .AddEntityFrameworkProxies() .BuildServiceProvider(); var options = new DbContextOptionsBuilder <CBVinilContext>() .UseInMemoryDatabase(dbName) .UseInternalServiceProvider(serviceProvider) .UseLazyLoadingProxies() .Options; var context = new CBVinilContext(options); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); if (seed != null) { seed.Seed(context); } context.SaveChanges(); return(context); }
public void Seed(CBVinilContext context) { context.GeneroMusical.AddRange(GeneroMusicalSeed.Seeds); context.DiaSemana.AddRange(DiaSemanaSeed.Seeds); context.Disco.AddRange(DiscoTestSeed.Seeds); context.Venda.AddRange(VendaTestSeed.Seeds); }
public void Seed(CBVinilContext context) { context.GeneroMusical.AddRange(GeneroMusicalSeed.Seeds); context.DiaSemana.AddRange(DiaSemanaSeed.Seeds); context.CashbackParametro.AddRange(CashbackParametroSeed.Seeds); context.Disco.AddRange(DiscoTestSeed.Seeds); context.Venda.AddRange(Seeds); }
public GetVendasQueryHandler(CBVinilContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public SpotifyService(CBVinilContext context, IOptions <SpotifySettings> options) { _context = context; _spotifySettings = options.Value; }
public VenderDiscosCommandHandler(CBVinilContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public GetGenerosMusicaisQueryHandler(CBVinilContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public void Seed(CBVinilContext context) { context.GeneroMusical.AddRange(GeneroMusicalSeed.Seeds); context.Disco.AddRange(Seeds); }
public static void Destroy(CBVinilContext context) { context.Database.EnsureDeleted(); context.Dispose(); }
public TestBase(ITestSeed seed) { _context = CBVinilContextFactoryTests.Create(seed); _mapper = AutoMapperFactory.Create(); }