public void FromDefaultConfig() { ISystemContext context = null; Assert.DoesNotThrow(() => context = new SystemContext(DbConfig.SystemDefault)); Assert.IsNotNull(context); Assert.IsFalse(context.ReadOnly()); Assert.IsTrue(context.IgnoreIdentifiersCase()); Assert.AreEqual("APP", context.DefaultSchema()); }
public void ResolveSingleServiceFromRegister() { ISystemContext context = null; Assert.DoesNotThrow(() => context = new SystemContext(DbConfig.SystemDefault)); Assert.IsNotNull(context); context.ServiceProvider.Register<TestService>(); object serviceObj = null; Assert.DoesNotThrow(() => serviceObj = context.ServiceProvider.Resolve(typeof(TestService))); Assert.IsNotNull(serviceObj); Assert.IsInstanceOf<TestService>(serviceObj); var service = (TestService)serviceObj; Assert.DoesNotThrow(() => service.SayHello()); }
public void ResolveManyServicesForInterface() { ISystemContext context = null; Assert.DoesNotThrow(() => context = new SystemContext(DbConfig.SystemDefault)); Assert.IsNotNull(context); context.ServiceProvider.Register<TestService>(); context.ServiceProvider.Register<TestService2>(); context.ServiceProvider.Register<TestService3>(); IEnumerable<ITestService> services = null; Assert.DoesNotThrow(() => services = context.ServiceProvider.ResolveAll<ITestService>()); Assert.IsNotNull(services); var serviceList = services.ToList(); Assert.IsNotEmpty(serviceList); Assert.AreEqual(2, serviceList.Count); Assert.IsInstanceOf<TestService2>(serviceList[0]); Assert.IsInstanceOf<TestService3>(serviceList[1]); }
internal DataCellCache(SystemContext context, ICache systemCache, int maxCacheSize, int maxCellSize) : this(context, systemCache, maxCacheSize, maxCellSize, 88547) { // Good prime number hash size }
/// <summary> /// Instantiate the <see cref="DataCellCache"/>. /// </summary> /// <param name="context></param> /// <param name="systemCache"></param> /// <param name="maxCacheSize">The maximum size in bytes that the cache /// is allowed to grow to (eg. 4000000).</param> /// <param name="maxCellSize">The maximum size of an object that can be /// stored in the cache.</param> /// <param name="hashSize">The number of elements in the hash (should be /// a prime number).</param> internal DataCellCache(SystemContext context, ICache systemCache, int maxCacheSize, int maxCellSize, int hashSize) { this.context = context; this.maxCellSize = maxCellSize; cache = new DCCache(this, systemCache, hashSize, maxCacheSize); }
public void TestSetup() { testSequenceName = ObjectName.Parse("APP.test_sequence"); var dbConfig = DbConfig.Empty; dbConfig.SetValue(DatabaseConfigKeys.DatabaseName, "testdb"); var systemContext = new SystemContext(DbConfig.SystemDefault); var dbContext = new DatabaseContext(systemContext, dbConfig); var database = new Database(dbContext); database.Create("SA", "12345"); database.Open(); transaction = database.CreateTransaction(TransactionIsolation.Serializable); if (TestContext.CurrentContext.Test.Name != "CreateNormalSequence") { var seqInfo = new SequenceInfo(testSequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126); transaction.CreateSequence(seqInfo); } }