コード例 #1
0
        public void MigrateIfNeeded_HasPrefsFile_LdmlLastestVersion()
        {
            using (var e = new TestEnvironment())
            {
                e.WriteToPrefsFile(WritingSystemPrefsFileContent.SingleWritingSystemForLanguage("qaa-x-test"));
                var migrator = new WritingSystemsMigrator(e.ProjectPath);
                migrator.MigrateIfNecessary();

                AssertThatXmlIn.File(e.WritingSystemFilePath("qaa-x-test")).HasAtLeastOneMatchForXpath(
                    String.Format("/ldml/special/palaso:version[@value='{0}']", WritingSystemDefinition.LatestWritingSystemDefinitionVersion),
                    e.NamespaceManager);
            }
        }
コード例 #2
0
 public void MigrateIfNeeded_PrefsFileContainsIdThatIsNotMigrated_WritingSystemChangeLogDoesNotExist()
 {
     using (var e = new TestEnvironment())
     {
         e.WriteToPrefsFile(WritingSystemPrefsFileContent.SingleWritingSystemForLanguage("en"));
         string writingSystemsPath  = Path.Combine(e.ProjectPath, "WritingSystems");
         string idChangeLogFilePath = Path.Combine(writingSystemsPath, "idchangelog.xml");
         Directory.CreateDirectory(writingSystemsPath);
         var migrator = new WritingSystemsMigrator(e.ProjectPath);
         migrator.MigrateIfNecessary();
         // The change log does not exist because no id needed migrating
         Assert.That(File.Exists(idChangeLogFilePath), Is.Not.True);
     }
 }
コード例 #3
0
        public void MigrateIfNecessary_LdmlForWritingSystemInWsPrefsFileAlreadyExists_LdmlIsUntouched()
        {
            using (var environment = new TestEnvironment())
            {
                environment.WriteContentToWsPrefsFile(WritingSystemPrefsFileContent.SingleWritingSystemForLanguage("en"));

                var ws = WritingSystemDefinition.Parse("en");
                ws.Abbreviation = "untouched";
                var wsRepo = environment.WritingSystems;
                wsRepo.Set(ws);
                wsRepo.Save();

                var migrator = new WritingSystemPrefsMigrator(
                    environment.WsPrefsFilePath,
                    environment.ChangeRfcTags);
                migrator.MigrateIfNecassary();

                AssertThatXmlIn.File(environment.GetFileForOriginalRfcTag("en")).HasAtLeastOneMatchForXpath(
                    "/ldml/special/palaso:abbreviation[@value='untouched']",
                    environment.NamespaceManager);
            }
        }