Example #1
0
        protected void GivenTheInMemoryDatabase()
        {
            //// Bit of a hack to ensure a new instance of in memory database for each test
            //// See https://github.com/aspnet/Home/issues/1541
            //var services = new ServiceCollection();

            //services.AddEntityFrameworkInMemoryDatabase()
            //    .AddDbContext<PackageManagerContext>(x => x
            //        .UseInMemoryDatabase()
            //        .UseInternalServiceProvider(services.BuildServiceProvider()));

            //_db = services.BuildServiceProvider().GetRequiredService<PackageManagerContext>();

            // In future, should hopefully just be able to do this...
            var optionsBuilder = new DbContextOptionsBuilder <ServiceBusDepotContext>();

            optionsBuilder.UseInMemoryDatabase();
            _database = new ServiceBusDepotContext(optionsBuilder.Options);
        }
 public CommandHandler(ServiceBusDepotContext database, IMapper mapper)
 {
     _database = database;
     _mapper = mapper;
 }