Esempio n. 1
0
 protected GraphUpdatesInMemoryFixtureBase()
 {
     _serviceProvider = new ServiceCollection()
                        .AddEntityFramework()
                        .AddInMemoryDatabase()
                        .ServiceCollection()
                        .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                        .BuildServiceProvider();
 }
Esempio n. 2
0
 public DataAnnotationInMemoryFixture()
 {
     _serviceProvider = new ServiceCollection()
                        .AddEntityFramework()
                        .AddInMemoryDatabase()
                        .ServiceCollection()
                        .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                        .BuildServiceProvider();
 }
 public StoreGeneratedInMemoryFixture()
 {
     _serviceProvider = new ServiceCollection()
                        .AddEntityFramework()
                        .AddInMemoryStore()
                        .ServiceCollection()
                        .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                        .BuildServiceProvider();
 }
Esempio n. 4
0
            public GraphUpdatesInMemoryFixture()
            {
                _serviceProvider = new ServiceCollection()
                                   .AddEntityFramework()
                                   .AddInMemoryDatabase()
                                   .ServiceCollection()
                                   .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                                   .BuildServiceProvider();

                _optionsBuilder = new DbContextOptionsBuilder();
                _optionsBuilder.UseInMemoryDatabase();
            }
Esempio n. 5
0
        public BuiltInDataTypesInMemoryFixture()
        {
            _testStore       = new InMemoryTestStore();
            _serviceProvider = new ServiceCollection()
                               .AddEntityFramework()
                               .AddInMemoryDatabase()
                               .ServiceCollection()
                               .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                               .BuildServiceProvider();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseInMemoryDatabase();
            _options = optionsBuilder.Options;
        }
Esempio n. 6
0
            public NullKeysInMemoryFixture()
            {
                _serviceProvider = new ServiceCollection()
                                   .AddEntityFramework()
                                   .AddInMemoryStore()
                                   .ServiceCollection()
                                   .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                                   .BuildServiceProvider();

                var optionsBuilder = new EntityOptionsBuilder();

                optionsBuilder.UseInMemoryStore(persist: true);
                _options = optionsBuilder.Options;

                EnsureCreated();
            }
        public ComplexNavigationsQueryInMemoryFixture()
        {
            _serviceProvider
                = new ServiceCollection()
                  .AddEntityFramework()
                  .AddInMemoryDatabase()
                  .ServiceCollection()
                  .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                  .BuildServiceProvider();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseInMemoryDatabase();

            _options = optionsBuilder.Options;
        }
Esempio n. 8
0
        public InheritanceInMemoryFixture()
        {
            _serviceProvider
                = new ServiceCollection()
                  .AddEntityFramework()
                  .AddInMemoryDatabase()
                  .ServiceCollection()
                  .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                  .BuildServiceProvider();

            _optionsBuilder.UseInMemoryDatabase();

            using (var context = CreateContext())
            {
                SeedData(context);
            }
        }
Esempio n. 9
0
        public OneToOneQueryInMemoryFixture()
        {
            _serviceProvider
                = new ServiceCollection()
                  .AddEntityFramework()
                  .AddInMemoryStore()
                  .ServiceCollection()
                  .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                  .BuildServiceProvider();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseInMemoryStore();
            _options = optionsBuilder.Options;

            using (var context = new DbContext(_serviceProvider, _options))
            {
                AddTestData(context);
            }
        }
Esempio n. 10
0
        public NorthwindQueryInMemoryFixture()
        {
            _serviceProvider
                = new ServiceCollection()
                  .AddEntityFramework()
                  .AddInMemoryDatabase()
                  .ServiceCollection()
                  .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                  .BuildServiceProvider();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseInMemoryDatabase();
            _options = optionsBuilder.Options;

            using (var context = CreateContext())
            {
                NorthwindData.Seed(context);
            }
        }