Exemple #1
0
        public void CreateNonExistentWritingSystemsFoundInConfig_FieldsXmlContainsRfcTagThatAfterBeingMadeConformMatchesExistingLdml_LdmlFilesAreLeftUnchanged()
        {
            using (var environment = new TestEnvironment(
                       ConfigFileContentForTests.WrapContentInConfigurationTags(
                           ConfigFileContentForTests.GetConfigFileSnippetContainingFieldWithWritingSystems("en", "audio"))))
            {
                var wsRepo = environment.WritingSystems;

                var enWs = WritingSystemDefinition.Parse("en");
                enWs.Abbreviation = "Dont change me!";
                wsRepo.Set(enWs);
                wsRepo.Save();

                environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);
                AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
                    "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='en']");
                AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
                    "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='qaa-Zxxx-x-audio']");

                var pathToLdml = Path.Combine(environment.WritingSystemsPath, "en.ldml");
                AssertThatXmlIn.File(pathToLdml).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='en']");
                AssertThatXmlIn.File(pathToLdml).HasNoMatchForXpath("/ldml/identity/script");
                AssertThatXmlIn.File(pathToLdml).HasNoMatchForXpath("/ldml/identity/territory");
                AssertThatXmlIn.File(pathToLdml).HasNoMatchForXpath("/ldml/identity/variant");
                AssertThatXmlIn.File(pathToLdml).
                HasAtLeastOneMatchForXpath("/ldml/special/palaso:abbreviation[@value='Dont change me!']", environment.NamespaceManager);
            }
        }
Exemple #2
0
        public void CreateNonExistentWritingSystemsFoundInConfig_FieldsXmlContainsNonConformantRfcTagWithDuplicatesAndAlreadyhasDuplicateMarker_UpdatesRfcTagInFieldsXmlOfConfigFile()
        {
            using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(
                                                             ConfigFileContentForTests.GetConfigFileSnippetContainingFieldWithWritingSystems("qaa-audio-dupl1", "qaa-Zxxx-x-audio-dupl1"))))
            {
                environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);
                AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
                    "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='qaa-Zxxx-x-audio-dupl1']");
                AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
                    "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='qaa-Zxxx-x-audio-dupl1-dupl0']");


                string writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "qaa-Zxxx-x-audio-dupl1-dupl0" + ".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-dupl1-dupl0']");

                writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "qaa-Zxxx-x-audio-dupl1" + ".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-dupl1']");
            }
        }
Exemple #3
0
        public void CreateNonExistentWritingSystemsFoundInConfig_WS34066RegressionTest_UpdatesRfcTagInFieldsXmlOfConfigFile()
        {
            using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(
                                                             ConfigFileContentForTests.GetConfigFileSnippetContainingFieldWithWritingSystems("qaa-x-aaa", "aaa"))))
            {
                environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);

                AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
                    "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='qaa-x-aaa']");
                AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
                    "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='aaa']");


                string writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "qaa-x-aaa" + ".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-aaa']");

                writingSystemFilePath = Path.Combine(environment.WritingSystemsPath, "aaa" + ".ldml");
                AssertThatXmlIn.File(writingSystemFilePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='aaa']");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/script");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/territory");
                AssertThatXmlIn.File(writingSystemFilePath).HasNoMatchForXpath("/ldml/identity/variant");
            }
        }
Exemple #4
0
 public void CreateNonExistentWritingSystemsFoundInConfig_FieldContainsNonConformantRfcTag_UpdatesRfcTagInFieldXmlOfConfigFile()
 {
     using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(ConfigFileContentForTests.GetConfigFileSnippetContainingFieldWithWritingSystems("bogusws1", "audio"))))
     {
         environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems);
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='qaa-x-bogusws1']");
         AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath(
             "/configuration/components/viewTemplate/fields/field/writingSystems/id[text()='qaa-Zxxx-x-audio']");
     }
 }
Exemple #5
0
        public void CreateNonExistentWritingSystemsFoundInConfig_FieldXmlContainsNonConformantRfcTag_CreatesConformingWritingSystem()
        {
            using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(ConfigFileContentForTests.GetConfigFileSnippetContainingFieldWithWritingSystems("bogusws1", "audio"))))
            {
                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']");
            }
        }