public void CreateNonExistentWritingSystemsFoundInConfig_TasksXmlContainsNonConformantRfcTag_UpdatesRfcTagInTasksXmlOfConfigFile() { using (var environment = new TestEnvironment( ConfigFileContentForTests.WrapContentInConfigurationTags( ConfigFileContentForTests.GetConfigFileSnippetContainingMissingInfoTaskWithWritingSystems("bogusws1", "audio", "de", "Zxxx")))) { environment.Creator.CreateWritingSystemsForIdsInFileWhereNecassary(environment.WritingSystems); AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath( "/configuration/tasks/task/writingSystemsToMatch[text()='qaa-x-bogusws1, qaa-Zxxx-x-audio']"); AssertThatXmlIn.File(environment.ConfigFilePath).HasAtLeastOneMatchForXpath( "/configuration/tasks/task/writingSystemsWhichAreRequired[text()='de, qaa-x-Zxxx']"); } }
public void CreateNonExistentWritingSystemsFoundInConfig_TasksXmlContainsNonConformantRfcTag_CreatesConformingWritingSystem() { using (var environment = new TestEnvironment(ConfigFileContentForTests.WrapContentInConfigurationTags(ConfigFileContentForTests.GetConfigFileSnippetContainingMissingInfoTaskWithWritingSystems("bogusws1", "audio", "de", "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']"); } }