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)); }
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)); }
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)); }
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."); } }
public Delete(IInstallerRepository repo) { _repo = repo; }
public Create(IInstallerRepository repo) { _repo = repo; }
public InstallerService(IInstallerRepository installerRepository) { _installerRepository = installerRepository; }
public Update(IInstallerRepository repo) { _repo = repo; }