Наследование: Rebel.Hive.AbstractProviderBootstrapper
        public void NHibernateBootstrapper_Requires_Configuration()
        {
            var boot = new ProviderBootstrapper(null, null, new FakeFrameworkContext());

            var status = boot.GetInstallStatus();

            Assert.AreEqual(InstallStatusType.RequiresConfiguration, status.StatusType);
        }
        public void NHibernateBootstrapper_Completed()
        {
            var builder = new NHibernateConfigBuilder("data source=:memory:", "unit-tester", SupportedNHDrivers.SqlLite, "thread_static", false);
            var config = builder.BuildConfiguration();
            var boot = new ProviderBootstrapper(config, new ProviderConfigurationSection()
            {
                ConnectionStringKey = "data source=:memory:",
                Driver = SupportedNHDrivers.SqlLite,
                SessionContext = "thread_static"
            }, new FakeFrameworkContext());

            var status = boot.TryInstall();

            Assert.AreEqual(InstallStatusType.Completed, status.StatusType);
        }
        public void NHibernateBootstrapper_Tried_And_Failed()
        {

            var localConfig = new ProviderConfigurationSection()
                {
                    ConnectionStringKey = "This is an invalid conn string",
                    Driver = SupportedNHDrivers.MsSql2008,
                    SessionContext = "web"
                };
            var builder = new NHibernateConfigBuilder(localConfig.ConnectionStringKey, "test", localConfig.Driver, "thread_static", false);
            var config = builder.BuildConfiguration();
            var boot = new ProviderBootstrapper(config, localConfig, new FakeFrameworkContext());

            var status = boot.TryInstall();

            Assert.AreEqual(InstallStatusType.TriedAndFailed, status.StatusType);
        }
        public void NHibernateBootstrapper_Configure_Application()
        {
            //Arrange

            //create a new web.config file in /plugins for the providers to write to
            var http = new FakeHttpContextFactory("~/test");
            var configFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, "nhibernate.config"));
            var configMgr = new DeepConfigManager(http.HttpContext);
            var configXml = DeepConfigManager.CreateNewConfigFile(configFile, true);
            var installModel = new DatabaseInstallModel()
                {
                    DatabaseType = DatabaseServerType.MSSQL,
                    DatabaseName = "test",
                    Server = "testserver",
                    Username = "******",
                    Password = "******"
                };
            var boot = new ProviderBootstrapper(null, null, new FakeFrameworkContext());


            //Act

            boot.ConfigureApplication("rw-test", "test", configXml, new BendyObject(installModel));

            //Assert

            Assert.AreEqual(@"<configuration>
  <configSections>
    <sectionGroup name=""rebel"">
      <sectionGroup name=""persistenceProviderSettings"">
        <section name=""test"" type=""Rebel.Framework.Persistence.NHibernate.Config.ProviderConfigurationSection, Rebel.Framework.Persistence.NHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"" />
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name=""test.ConnString"" connectionString=""Data Source=testserver; Initial Catalog=test;User Id=testuser;Password=testpass"" providerName=""System.Data.SqlClient"" />
  </connectionStrings>
  <appSettings />
  <rebel>
    <persistenceProviderSettings>
      <test connectionStringKey=""test.ConnString"" sessionContext=""web"" driver=""MsSql2008"" />
    </persistenceProviderSettings>
  </rebel>
</configuration>", configXml.ToString());

        }