public DbContext ClassicCreation()
 {
     using var connection = new SqliteConnection("Data Source=:memory:;");
     connection.Open();
     using var context = TestDbContextProvider.CreateDbContext(connection);
     context.Database.Migrate();
     scaffold.Run(context);
     return(context);
 }
Example #2
0
        private static async Task <EntityMergeCrud <TestModel, TestDbContext> > CreateCrud()
        {
            var provider = new TestDbContextProvider();
            var context  = provider.GetContext();

            context.Models.RemoveRange(context.Models);
            var crud = new TestCrud(provider);
            await context.SaveChangesAsync();

            return(crud);
        }
        public void DatabaseCreated()
        {
            var scaffold = new DatabaseScaffold();

            using var connection = new SqliteConnection("Data Source=:memory:;");
            connection.Open();
            using (var context = TestDbContextProvider.CreateDbContext(connection))
            {
                context.Database.Migrate();
                scaffold.Run(context);
            }
            using (var context = TestDbContextProvider.CreateDbContext(connection))
            {
                TestHelpers.ShouldBePrepared(context);
            }
        }
Example #4
0
 public TestCrud(TestDbContextProvider provider) : base(provider, false)
 {
 }
 public void EstablishContext()
 {
     _provider   = TestContextCreator.Create();
     _unitOfWork = new EntityFrameworkUnitOfWork(_provider);
 }