当前位置: 首页>>代码示例>>C#>>正文


C# TestEnvironment.WriteLdmlFile方法代码示例

本文整理汇总了C#中TestEnvironment.WriteLdmlFile方法的典型用法代码示例。如果您正苦于以下问题:C# TestEnvironment.WriteLdmlFile方法的具体用法?C# TestEnvironment.WriteLdmlFile怎么用?C# TestEnvironment.WriteLdmlFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestEnvironment的用法示例。


在下文中一共展示了TestEnvironment.WriteLdmlFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Migrate_LdmlContainsWritingSystemThatIsVersion0_MigratedToLatest

		public void Migrate_LdmlContainsWritingSystemThatIsVersion0_MigratedToLatest()
		{
			using (var environment = new TestEnvironment())
			{
				const string fileName = "en-Zxxx-x-audio.ldml";
				environment.WriteLdmlFile(fileName, LdmlContentForTests.Version0("en", "Zxxx", "", "x-audio"));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				Assert.AreEqual(2, environment.GetFileVersion(fileName));
			}
		}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:13,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例2: Migrate_WritingSystemRepositoryNeedsMigrating_WSChangeLogUpdated

		public void Migrate_WritingSystemRepositoryNeedsMigrating_WSChangeLogUpdated()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("en-bogus.ldml",
										  LdmlContentForTests.Version0("en-bogus", "", "", ""));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				string idChangeLogFilePath = Path.Combine(environment.LdmlPath, "idchangelog.xml");
				AssertThatXmlIn.File(idChangeLogFilePath).HasAtLeastOneMatchForXpath("/WritingSystemChangeLog/Changes/Change[From/text()='en-bogus' and To/text()='en-x-bogus']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例3: Migrate_OriginalFileContainsLdmlDataWeDontCareAbout_DataIsCopied

		public void Migrate_OriginalFileContainsLdmlDataWeDontCareAbout_DataIsCopied()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0WithLdmlInfoWeDontCareAbout("","","",""));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='qaa']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/fallback/testing[text()='fallback']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/measurement/testing[text()='measurement']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/dates/testing[text()='dates']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/units/testing[text()='units']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/listPatterns/testing[text()='listPatterns']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/posix/testing[text()='posix']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/segmentations/testing[text()='segmentations']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/rbnf/testing[text()='rbnf']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/references/testing[text()='references']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:21,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例4: using

		public void Migrate_FlexEntirelyPrivateUseLdmlContainingLanguageScriptRegionVariant_WritingSystemVariantIsConcatOfPrivateUseVariant()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("x-en", "Zxxx", "US", "1901-x-audio"));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='qaa']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/script[@type='Zxxx']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/territory[@type='US']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant[@type='1901-x-en-audio']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例5: Migrate_LanguageSubtagContainsDuplicatePrivateUse_DuplicateIsRemoved

		public void Migrate_LanguageSubtagContainsDuplicatePrivateUse_DuplicateIsRemoved()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("bogus", "", "", "x-bogus"));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='qaa']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant[@type='x-bogus']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:11,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例6: Migrate_LanguageSubtagContainsOnlyInvalidData_DataIsMovedToPrivateUseAndLanguageSubtagIsSetToQaa

		public void Migrate_LanguageSubtagContainsOnlyInvalidData_DataIsMovedToPrivateUseAndLanguageSubtagIsSetToQaa()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("bogus-stuff", "", "", ""));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='qaa']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant[@type='x-bogus-stuff']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:11,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例7: Migrate_VariantContainsDuplicate_DuplicateIsmovedToPrivateUse

		public void Migrate_VariantContainsDuplicate_DuplicateIsmovedToPrivateUse()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("en", "", "", "biske-BiSKe"));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant[@type='biske-x-BiSKe']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:10,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例8: Migrate_LanguageSubtagContainsxDashEmic_xDashEmicIsMovedToPrivateUseSubtag

		public void Migrate_LanguageSubtagContainsxDashEmic_xDashEmicIsMovedToPrivateUseSubtag()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("en-fonipa-x-emic", "", "", ""));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='en']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant[@type='fonipa-x-emic']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例9: Migrate_VariantContainsMultipleValidVariants_ValidVariantsAreLeftUntouched

		public void Migrate_VariantContainsMultipleValidVariants_ValidVariantsAreLeftUntouched()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("en", "", "", "biske-bogus-bauddha"));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='en']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant[@type='biske-bauddha-x-bogus']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:11,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例10: Migrate_RepoContainsRfcTagsThatWillBeMigrated_DelegateIsCalledAndHasCorrectMap

		public void Migrate_RepoContainsRfcTagsThatWillBeMigrated_DelegateIsCalledAndHasCorrectMap()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("bogus.ldml", LdmlContentForTests.Version0("en-x-audio", "", "", ""));
				environment.WriteLdmlFile("bogus1.ldml", LdmlContentForTests.Version0("de", "bogus", "stuff", ""));
				environment.WriteLdmlFile("bogus2.ldml", LdmlContentForTests.Version0("en", "Zxxx", "", "x-audio"));
				environment.WriteLdmlFile("bogus3.ldml", LdmlContentForTests.Version0("zh", "", "CN", ""));
				environment.WriteLdmlFile("bogus4.ldml", LdmlContentForTests.Version0("cmn", "", "", ""));

				var migrationInfo = new Dictionary<int, LdmlMigrationInfo[]>();
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath,
					(toVersion, infos) => migrationInfo[toVersion] = infos.ToArray());
				migrator.Migrate();

				AssertMigrationInfoContains(migrationInfo[2], "de-bogus-stuff", "de-Qaaa-QM-x-bogus-stuff");
				AssertMigrationInfoContains(migrationInfo[2], "en-Zxxx-x-audio", "en-Zxxx-x-audio");
				AssertMigrationInfoContains(migrationInfo[2], "en-x-audio", "en-Zxxx-x-audio-dupl0");
				AssertMigrationInfoContains(migrationInfo[2], "zh-CN", "zh-CN");
				AssertMigrationInfoContains(migrationInfo[2], "cmn", "zh-CN-x-dupl0");

				AssertMigrationInfoContains(migrationInfo[3], "de-Qaaa-QM-x-bogus-stuff", "de-Qaaa-QM-x-bogus-stuff");
				AssertMigrationInfoContains(migrationInfo[3], "en-Zxxx-x-audio", "en-Zxxx-x-audio");
				AssertMigrationInfoContains(migrationInfo[3], "en-Zxxx-x-audio-dupl0", "en-Zxxx-x-audio-dupl0");
				AssertMigrationInfoContains(migrationInfo[3], "zh-CN", "zh-CN");
				AssertMigrationInfoContains(migrationInfo[3], "zh-CN-x-dupl0", "zh-CN-x-dupl0");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:28,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例11: Migrate_RepoContainsMultipleDuplicatesEn_DuplicatesAreRenamedAndMarkedCorrectly

		public void Migrate_RepoContainsMultipleDuplicatesEn_DuplicatesAreRenamedAndMarkedCorrectly()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("bogus.ldml", LdmlContentForTests.Version1("en", "", "", ""));
				environment.WriteLdmlFile("bogus1.ldml", LdmlContentForTests.Version1("en", "Latn", "", ""));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				Assert.True(File.Exists(environment.MappedFilePath("bogus.ldml")));
				Assert.True(File.Exists(environment.MappedFilePath("bogus1.ldml")));
				AssertLdmlHasXpath(environment.MappedFilePath("bogus.ldml"), "/ldml/identity/language[@type='en']");
				AssertLdmlHasXpath(environment.MappedFilePath("bogus1.ldml"), "/ldml/identity/language[@type='en']");
				AssertLdmlHasNoXpath(environment.MappedFilePath("bogus1.ldml"), "/ldml/identity/script");
				AssertLdmlHasXpath(environment.MappedFilePath("bogus1.ldml"), "/ldml/identity/variant[@type='x-dupl0']");
			}
			
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:19,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例12: Migrate_WritingSystemRepositoryNoNeedForMigration_WSChangeLogDoesntExist

		public void Migrate_WritingSystemRepositoryNoNeedForMigration_WSChangeLogDoesntExist()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("en.ldml",
										  LdmlContentForTests.Version0("en", "", "", ""));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				string idChangeLogFilePath = Path.Combine(environment.LdmlPath, "idchangelog.xml");
				Assert.IsFalse(File.Exists(idChangeLogFilePath));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例13: Migrate_RegionContainsTagThatIsValidRegion_IsMigrated

		public void Migrate_RegionContainsTagThatIsValidRegion_IsMigrated()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("en", "", "DE", ""));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='en']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/territory[@type='DE']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:11,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例14: Migrate_LanguageSubtagIsIso3Code_UseIso1Code

		public void Migrate_LanguageSubtagIsIso3Code_UseIso1Code()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("eng", String.Empty, String.Empty, String.Empty));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='en']");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs

示例15: Migrate_LanguageSubtagAndRegionSubtagContainValidDuplicates_DataIsNotDuplicatedInPrivateUse

		public void Migrate_LanguageSubtagAndRegionSubtagContainValidDuplicates_DataIsNotDuplicatedInPrivateUse()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0("de", "", "DE", ""));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/language[@type='de']");
				AssertLdmlHasXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/territory[@type='DE']");
				AssertLdmlHasNoXpath(environment.MappedFilePath("test.ldml"), "/ldml/identity/variant");
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs


注:本文中的TestEnvironment.WriteLdmlFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。