public void PathConstructor_HasCorrectPath() { using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests")) { var repo = new GlobalWritingSystemRepository(e.Path); Assert.That(repo.PathToWritingSystems, Is.StringMatching(".*GlobalWritingSystemRepositoryTests.2")); } }
public void Constructor_CreatesFolders() { using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests")) { var repo = new GlobalWritingSystemRepository(e.Path); Assert.That(Directory.Exists(repo.PathToWritingSystems), Is.True); } }
public void Constructor_WithExistingFolders_NoThrow() { using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests")) { new GlobalWritingSystemRepository(e.Path); var repo2 = new GlobalWritingSystemRepository(e.Path); Assert.That(Directory.Exists(repo2.PathToWritingSystems), Is.True); } }
///<summary> /// This initializer is intended for tests as it allows setting of the basePath explicitly. ///</summary> ///<param name="basePath">base location of the global writing system repository</param> ///<param name="migrationHandler">Callback if during the initialization any writing system id's are changed</param> internal static GlobalWritingSystemRepository InitializeWithBasePath(string basePath, LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler) { lock (_padlock) { if (_instance == null) { var migrator = new GlobalWritingSystemRepositoryMigrator(basePath, migrationHandler); if (migrator.NeedsMigration()) { migrator.Migrate(); } _instance = new GlobalWritingSystemRepository(basePath); _instance.LoadAllDefinitions(); } } return(_instance); }
///<summary> /// This initializer is intended for tests as it allows setting of the basePath explicitly. ///</summary> ///<param name="basePath">base location of the global writing system repository</param> ///<param name="migrationHandler">Callback if during the initialization any writing system id's are changed</param> internal static GlobalWritingSystemRepository InitializeWithBasePath(string basePath, LdmlVersion0MigrationStrategy.MigrationHandler migrationHandler) { lock (_padlock) { if (_instance == null) { var migrator = new GlobalWritingSystemRepositoryMigrator(basePath, migrationHandler); if (migrator.NeedsMigration()) { migrator.Migrate(); } _instance = new GlobalWritingSystemRepository(basePath); _instance.LoadAllDefinitions(); } } return _instance; }