Пример #1
0
        public void AddRepository_T()
        {
            var services = new ServiceCollection();
            var builder  = new ScorpioDbContextOptionsBuilder <TestDbContext>(services);

            Should.NotThrow(() => builder.AddRepository <TestTable, EfCoreRepository <TestDbContext, TestTable> >());
        }
Пример #2
0
        public void SetDefaultRepository()
        {
            var services = new ServiceCollection();
            var builder  = new ScorpioDbContextOptionsBuilder <TestDbContext>(services);

            Should.Throw <ScorpioException>(() => builder.SetDefaultRepository(typeof(object)));
            Should.NotThrow(() => builder.SetDefaultRepository(typeof(EfCoreRepository <, ,>)));
        }
Пример #3
0
        public void UseMemoryCache()
        {
            var services = new ServiceCollection();
            var builder  = new ScorpioDbContextOptionsBuilder <TestDbContext>(services);
            var b        = new DbContextOptionsBuilder <TestDbContext>();

            Should.NotThrow(() => builder.UseMemoryCache(null));
            b.Options.Extensions.IsNullOrEmpty();
            builder.OptionsActions.ForEach(a => a(b));
            b.Options.Extensions.ShouldHaveSingleItem();
        }