예제 #1
0
        /// <summary>
        /// In the test fixture setup I simply ovveride the configuration registry
        /// using an in memory configuration with a fixed connection string.
        /// </summary>
        protected override void OnTestFixtureSetUp()
        {
            sut = new NHibernateRepository <AnEntity>();
            sut.ConfigurationFileName = ConfigFileName;
            repo = new InMemoryConfigurationRegistry();
            repo.ConnStrings.Add(
                "main", new ConnectionStringSettings(
                    "main", "Data Source=DbFile1.db;Version=3", "System.Data.SQLite"));
            DisposeAtTheEndOfFixture(ConfigurationRegistry.Override(repo));
            NHibernateSessionManager.GenerateDbFor(ConfigFileName);

            base.OnTestFixtureSetUp();
        }
        public void TestFixtureSetUp()
        {
            overrideContext        = new TestContext();
            OverrideContextCleanUp = CurrentContext.Override(overrideContext);
            repo = new InMemoryConfigurationRegistry();
            repo.ConnStrings.Add(
                "main", new ConnectionStringSettings(
                    "main", "Data Source=DbFile1.db;Version=3", "System.Data.SQLite"));
            repo.ConnStrings.Add(
                "NhConfig1", new ConnectionStringSettings(
                    "NhConfig1", "Data Source=:memory:;Version=3;New=True;", "System.Data.SQLite"));
            repo.ConnStrings.Add(
                "NhConfig2", new ConnectionStringSettings(
                    "NhConfig2", "Data Source=:memory:;Version=3;New=True;", "System.Data.SQLite"));

            OverrideSettings = ConfigurationRegistry.Override(repo);

            NHibernateSessionManager.GenerateDbFor("files//NhConfigFile1.cfg.xml");
        }