public DatabaseFixture()
        {
            _parentContext = new BrewContext();
            _parentContext.Database.Connection.Open();
            // This could be a simple SqlConnection if using sql express, but if using localdb you need a context so that EF creates the database if it doesn't exist (thanks EF!)
            _transaction = _parentContext.Database.Connection.BeginTransaction();

            SeedDbContext = GetNewDbContext();
            WorkDbContext = GetNewDbContext();
            VerifyDbContext = GetNewDbContext();
        }
        static DatabaseFixture()
        {
            var testPath = Path.GetDirectoryName(typeof(DatabaseFixture).Assembly.CodeBase.Replace("file:///", ""));

            AppDomain.CurrentDomain.SetData("DataDirectory", testPath);
            // For localdb connection string that uses |DataDirectory|

            using (var migrationsContext = new BrewContext())
            {
                migrationsContext.Database.Initialize(false); // Performs EF migrations
            }
        }
 private BrewContext GetNewDbContext()
 {
     var context = new BrewContext(_parentContext.Database.Connection);
     context.Database.UseTransaction(_transaction);
     return context;
 }
 public AddBrewController(BrewContext context)
 {
     _context = context;
 }
 public RemoveBrewController(BrewContext context)
 {
     _context = context;
 }
 public IndexHomeController(BrewContext context)
 {
     _context = context;
 }