Exemplo n.º 1
0
 public void CreateNonExistentWritingSystemsFoundInConfig_AddinsXmlContainsNonConformantRfcTag_UpdatesRfcTagInAddinsXmlOfConfigFile()
 {
     using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(
                                                      ConfigFileContentForTests.GetConfigFileContainingSfmExporterAddinWithWritingSystems("en", "bogusws1", "audio", "Zxxx"))))
     {
         environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/EnglishLanguageWritingSystemId[text()='en']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/NationalLanguageWritingSystemId[text()='qaa-x-bogusws1']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/RegionalLanguageWritingSystemId[text()='qaa-Zxxx-x-audio']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/VernacularLanguageWritingSystemId[text()='qaa-x-Zxxx']");
     }
 }
Exemplo n.º 2
0
 public void CreateNonExistentWritingSystemsFoundInConfig_XmlContainsSameWsTwice_SecondInstanceIsNotSeenAsDuplicateWritingSystem()
 {
     using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(
                                                      ConfigFileContentForTests.GetConfigFileContainingSfmExporterAddinWithWritingSystems("qaa-audio", "qaa-audio", "en", "de"))))
     {
         environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/EnglishLanguageWritingSystemId[text()='qaa-Zxxx-x-audio']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/NationalLanguageWritingSystemId[text()='qaa-Zxxx-x-audio']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/RegionalLanguageWritingSystemId[text()='en']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/addins/addin/SfmTransformSettings/VernacularLanguageWritingSystemId[text()='de']");
     }
 }
Exemplo n.º 3
0
        public void CreateNonExistentWritingSystemsFoundInConfig_AddinsXmlContainsNonConformantRfcTag_CreatesConformingWritingSystem()
        {
            using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(ConfigFileContentForTests.GetConfigFileContainingSfmExporterAddinWithWritingSystems("de", "bogusws1", "audio", "Zxxx"))))
            {
                environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);


                string writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "qaa-x-bogusws1" + ".ldml");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='qaa']");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/script");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/territory");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/variant[@type='x-bogusws1']");

                writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "qaa-Zxxx-x-audio" + ".ldml");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='qaa']");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/script[@type='Zxxx']");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/territory");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/variant[@type='x-audio']");

                writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "de" + ".ldml");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='de']");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/script");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/territory");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/variant");

                writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "qaa-x-Zxxx" + ".ldml");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='qaa']");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/script");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/territory");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/variant[@type='x-Zxxx']");
            }
        }