Ejemplo n.º 1
0
 protected GraphUpdatesInMemoryFixtureBase()
 {
     _serviceProvider = new ServiceCollection()
                        .AddEntityFramework()
                        .AddInMemoryDatabase()
                        .ServiceCollection()
                        .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                        .BuildServiceProvider();
 }
Ejemplo 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();
 }
Ejemplo n.º 4
0
            public GraphUpdatesInMemoryFixture()
            {
                _serviceProvider = new ServiceCollection()
                                   .AddEntityFramework()
                                   .AddInMemoryDatabase()
                                   .ServiceCollection()
                                   .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                                   .BuildServiceProvider();

                _optionsBuilder = new DbContextOptionsBuilder();
                _optionsBuilder.UseInMemoryDatabase();
            }
Ejemplo 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;
        }
Ejemplo 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;
        }
Ejemplo n.º 8
0
        public InheritanceInMemoryFixture()
        {
            _serviceProvider
                = new ServiceCollection()
                  .AddEntityFramework()
                  .AddInMemoryDatabase()
                  .ServiceCollection()
                  .AddSingleton(TestInMemoryModelSource.GetFactory(OnModelCreating))
                  .BuildServiceProvider();

            _optionsBuilder.UseInMemoryDatabase();

            using (var context = CreateContext())
            {
                SeedData(context);
            }
        }
Ejemplo 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);
            }
        }
Ejemplo 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);
            }
        }