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


C# TestEnvironment.GetLdmlFile方法代码示例

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


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

示例1: GetLdmlFile_BadIetfLanguageTag_Throws

		public void GetLdmlFile_BadIetfLanguageTag_Throws()
		{
			using (var environment = new TestEnvironment())
			{
				const string ietfLanguageTag = "[email protected]#";
				string filename;
				Assert.Throws<ArgumentException>(
					() => environment.GetLdmlFile(ietfLanguageTag, out filename));
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:10,代码来源:SldrTests.cs

示例2: GetLdmlFile_NewFile_StatusFileFromSldr

		public void GetLdmlFile_NewFile_StatusFileFromSldr()
		{
			using (var environment = new TestEnvironment(false))
			{
				string filename;
				const string ietfLanguageTag = "en-GB";

				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.FromSldr));

				string filePath = Path.Combine(environment.FilePath, filename);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='en']", environment.NamespaceManager);
				AssertThatXmlIn.File(filePath).HasNoMatchForXpath("/ldml/identity/script", environment.NamespaceManager);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/territory[@type='GB']", environment.NamespaceManager);

				// Verify draft is approved and uid doesn't exist
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[@draft='approved']", environment.NamespaceManager);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[not(@uid)]", environment.NamespaceManager);
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:19,代码来源:SldrTests.cs

示例3: GetLdmlFile_NotModified_DoesntDownloadNewFile

		// This depends on when SLDR updates "en-US.ldml" with the revid 
		public void GetLdmlFile_NotModified_DoesntDownloadNewFile()
		{
			using (var environment = new TestEnvironment(false))
			{
				// Write 
				string content = LdmlContentForTests.Version3Identity("en", "", "US", "", "", "12345", "variantName", "", "53d542ba498f40f437f7723e69dcf64dab6c9794");
				const string ietfLanguageTag = "en-US";

				// Write content to destination and cache
				File.WriteAllText(Path.Combine(environment.FilePath, ietfLanguageTag + ".ldml"), content);
				File.WriteAllText(Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + ".ldml"), content);

				string filename;
				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.FromSldr));
				string filePath = Path.Combine(environment.FilePath, filename);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[@windowsLCID='12345']", environment.NamespaceManager);
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:19,代码来源:SldrTests.cs

示例4: GetLdmlFile_CacheFileWithUidUnknown_StatusFileFromSldrCache

		public void GetLdmlFile_CacheFileWithUidUnknown_StatusFileFromSldrCache()
		{
			using (var environment = new TestEnvironment())
			{
				string content =
@"<?xml version='1.0' encoding='utf-8'?>
<ldml>
	<identity>
		<version number='$Revision: 11161 $'/>
		<generation date='$Date: 2015-01-30 22:33 +0000 $'/>
		<language type='qaa'/>
		<special xmlns:sil='urn://www.sil.org/ldml/0.1'>
			<sil:identity source='cldr' draft='proposed' revid='53d542ba498f40f437f7723e69dcf64dab6c9794'/>
		</special>
		<script type='Latn'/>
	</identity>
</ldml>".Replace("\'", "\"");
				const string ietfLanguageTag = "qaa";
				string filename = Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + ".ldml");
				// File only exists in cache so uid unknown
				File.WriteAllText(filename, content);

				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.FromCache));
				string filePath = Path.Combine(environment.FilePath, filename);
				Assert.That(filename, Is.EqualTo(ietfLanguageTag + ".ldml"));
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='qaa']", environment.NamespaceManager);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/script[@type='Latn']", environment.NamespaceManager);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[@draft='proposed']", environment.NamespaceManager);
				AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[not(@uid)]", environment.NamespaceManager);
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:31,代码来源:SldrTests.cs

示例5: GetLdmlFile_CacheFileWithUid_StatusFileFromSldrCache

		public void GetLdmlFile_CacheFileWithUid_StatusFileFromSldrCache()
		{
			using (var environment = new TestEnvironment())
			{
				string content =
@"<?xml version='1.0' encoding='utf-8'?>
<ldml>
	<identity>
		<version number='$Revision: 11161 $'/>
		<generation date='$Date: 2015-01-30 22:33 +0000 $'/>
		<language type='qaa'/>
		<special xmlns:sil='urn://www.sil.org/ldml/0.1'>
			<sil:identity source='cldr' draft='proposed' revid='53d542ba498f40f437f7723e69dcf64dab6c9794' uid='e2ccb575'/>
		</special>
		<script type='Latn'/>
	</identity>
</ldml>".Replace("\'", "\"");
				const string ietfLanguageTag = "qaa";
				// File exists in destination and cache, so uid will be checked
				File.WriteAllText(Path.Combine(environment.FilePath, ietfLanguageTag + ".ldml"), content);
				string filename = Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + "-e2ccb575.ldml");
				File.WriteAllText(filename, content);

				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.FromCache));
				Assert.That(filename, Is.EqualTo(ietfLanguageTag + ".ldml"));
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:27,代码来源:SldrTests.cs

示例6: GetLdmlFile_LanguageTagWithSuppressedScript_DownloadsFile

		public void GetLdmlFile_LanguageTagWithSuppressedScript_DownloadsFile()
		{
			using (var environment = new TestEnvironment(false))
			{
				string filename;
				const string ietfLanguageTag = "oro";

				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.FromSldr));
				Assert.That(File.Exists(Path.Combine(environment.FilePath, filename)), Is.True);
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:11,代码来源:SldrTests.cs

示例7: GetLdmlFile_Fonipa_StatusFileNotFound

		public void GetLdmlFile_Fonipa_StatusFileNotFound()
		{
			using (var environment = new TestEnvironment())
			{
				string filename;
				const string ietfLanguageTag = "lo-LA-fonipa";

				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.NotFound));
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:10,代码来源:SldrTests.cs

示例8: GetLdmlFile_UnknownLanguage_StatusFileNotFound

		public void GetLdmlFile_UnknownLanguage_StatusFileNotFound()
		{
			using (var environment = new TestEnvironment(false))
			{
				string filename;
				const string ietfLanguageTag = "qaa";

				Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.NotFound));
			}
		}
开发者ID:regnrand,项目名称:libpalaso,代码行数:10,代码来源:SldrTests.cs


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