Пример #1
0
        public void GetRepository_should_return_correct_lightspeedrepository(string provider, string connectionString, DataProvider expectedProvider, Type expectedSchemaType)
        {
            // Arrange + Act
            IInstallerRepository installerRepository = _installationService.GetRepository(provider, connectionString);

            // Assert
            LightSpeedInstallerRepository lightSpeedInstallerRepository = installerRepository as LightSpeedInstallerRepository;

            Assert.That(lightSpeedInstallerRepository, Is.Not.Null);
            Assert.That(lightSpeedInstallerRepository.ConnectionString, Is.EqualTo(connectionString));
            Assert.That(lightSpeedInstallerRepository.DataProvider, Is.EqualTo(expectedProvider));
            Assert.That(lightSpeedInstallerRepository.Schema, Is.TypeOf(expectedSchemaType));
        }
Пример #2
0
        public void GetRepository_should_return_mongodb_repository()
        {
            // Arrange
            string provider         = "MONGODB";
            string connectionString = "mongodb-connection-string";

            // Act
            IInstallerRepository installerRepository = _installationService.GetRepository(provider, connectionString);

            // Assert
            MongoDbInstallerRepository mongoDbInstallerRepository = installerRepository as MongoDbInstallerRepository;

            Assert.That(mongoDbInstallerRepository, Is.Not.Null);
            Assert.That(mongoDbInstallerRepository.ConnectionString, Is.EqualTo(connectionString));
        }
Пример #3
0
        public void GetRepository_should_default_to_sqlserver_lightspeedrepository()
        {
            // Arrange
            string provider           = "anything";
            string connectionString   = "connection-string";
            Type   expectedSchemaType = typeof(SqlServerSchema);

            // Act
            IInstallerRepository installerRepository = _installationService.GetRepository(provider, connectionString);

            // Assert
            LightSpeedInstallerRepository lightSpeedInstallerRepository = installerRepository as LightSpeedInstallerRepository;

            Assert.That(lightSpeedInstallerRepository, Is.Not.Null);
            Assert.That(lightSpeedInstallerRepository.ConnectionString, Is.EqualTo(connectionString));
            Assert.That(lightSpeedInstallerRepository.DataProvider, Is.EqualTo(DataProvider.SqlServer2008));
            Assert.That(lightSpeedInstallerRepository.Schema, Is.TypeOf(expectedSchemaType));
        }
Пример #4
0
        public void Install(SettingsViewModel model)
        {
            try
            {
                IInstallerRepository installerRepository = _getRepositoryFunc(model.DatabaseName, model.ConnectionString);
                installerRepository.CreateSchema();

                if (model.UseWindowsAuth == false)
                {
                    installerRepository.AddAdminUser(model.AdminEmail, "admin", model.AdminPassword);
                }

                SiteSettings siteSettings = new SiteSettings();
                siteSettings.AllowedFileTypes    = model.AllowedFileTypes;
                siteSettings.AllowUserSignup     = model.AllowUserSignup;
                siteSettings.IsRecaptchaEnabled  = model.IsRecaptchaEnabled;
                siteSettings.MarkupType          = model.MarkupType;
                siteSettings.RecaptchaPrivateKey = model.RecaptchaPrivateKey;
                siteSettings.RecaptchaPublicKey  = model.RecaptchaPublicKey;
                siteSettings.SiteUrl             = model.SiteUrl;
                siteSettings.SiteName            = model.SiteName;
                siteSettings.Theme = model.Theme;

                // v2.0
                siteSettings.OverwriteExistingFiles = model.OverwriteExistingFiles;
                siteSettings.HeadContent            = model.HeadContent;
                siteSettings.MenuMarkup             = model.MenuMarkup;
                installerRepository.SaveSettings(siteSettings);

                // Attachments handler needs re-registering
                var appSettings = Locator.GetInstance <ApplicationSettings>();
                var fileService = Locator.GetInstance <IFileService>();
                AttachmentRouteHandler.RegisterRoute(appSettings, RouteTable.Routes, fileService);
            }
            catch (DatabaseException ex)
            {
                throw new DatabaseException(ex, "An exception occurred while saving the site configuration.");
            }
        }
Пример #5
0
 public Delete(IInstallerRepository repo)
 {
     _repo = repo;
 }
Пример #6
0
 public Create(IInstallerRepository repo)
 {
     _repo = repo;
 }
Пример #7
0
 public InstallerService(IInstallerRepository installerRepository)
 {
     _installerRepository = installerRepository;
 }
Пример #8
0
 public InstallerService(IInstallerRepository installerRepository)
 {
     _installerRepository = installerRepository;
 }
Пример #9
0
 public Update(IInstallerRepository repo)
 {
     _repo = repo;
 }