Ejemplo n.º 1
0
        public EntityFrameworkCoreTests()
        {
            var services = new ServiceCollection();

            services.AddDbContextPool <FakeContext>(options => options.UseInMemoryDatabase(nameof(FakeContext)));

            Context = services.BuildServiceProvider().GetService <FakeContext>();

            Context.Database.EnsureCreated();

            Repository = new FakeRepository(Context);

            SeedDatabase();
        }
        public EntityFrameworkCoreTests()
        {
            var services = new ServiceCollection();

            const string connectionString = "Server=(localdb)\\MSSQLLocalDB;Database=Tests;Integrated Security=true;Connection Timeout=5;";

            services.AddDbContextPool <FakeContext>(options => options.UseSqlServer(connectionString));

            Context = services.BuildServiceProvider().GetService <FakeContext>();

            Context.Database.EnsureCreated();

            Context.Database.Migrate();

            Repository = new FakeRepository(Context);

            SeedDatabase();
        }