• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TestUtilities.TemporaryFolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SIL.TestUtilities.TemporaryFolder的典型用法代码示例。如果您正苦于以下问题:C# TemporaryFolder类的具体用法?C# TemporaryFolder怎么用?C# TemporaryFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TemporaryFolder类属于SIL.TestUtilities命名空间,在下文中一共展示了TemporaryFolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestEnvironment

			public TestEnvironment()
			{
				_temporaryFolder = new TemporaryFolder("LiftLexEntryRepositoryTests");
				string filePath = _temporaryFolder.GetTemporaryFile();
				_repository = new LiftLexEntryRepository(filePath);
				_headwordWritingSystem = new WritingSystemDefinition("th") {DefaultCollation = new IcuRulesCollationDefinition("standard")};
			}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:7,代码来源:LexEntryRepositoryTests.cs


示例2: Constructor_CreatesTemporarySubDirectory

		public void Constructor_CreatesTemporarySubDirectory()
		{
			var temporaryFolder = new TemporaryFolder();
			Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:7,代码来源:TemporaryFolderTests.cs


示例3: OfflineSldr

		public OfflineSldr()
		{
			_sldrCacheFolder = new TemporaryFolder("SldrCacheTest");
			Sldr.SldrCachePath = _sldrCacheFolder.Path;
			Sldr.OfflineMode = true;
			Sldr.ResetLanguageTags();
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:7,代码来源:OfflineSldr.cs


示例4: SettingsFolderWithNewerConfig_SortsBeforeOneWithOlderConfig

		public void SettingsFolderWithNewerConfig_SortsBeforeOneWithOlderConfig()
		{

			using (var tempFolder = new TemporaryFolder())
			{
				var firstDirPath = Path.Combine(tempFolder.Path, "first");
				var secondDirPath = Path.Combine(tempFolder.Path, "second");
				var firstConfigFile = Path.Combine(firstDirPath, TestCrossPlatformSettingsProvider.UserConfigFileName);
				var secondConfigFile = Path.Combine(secondDirPath, TestCrossPlatformSettingsProvider.UserConfigFileName);
				Directory.CreateDirectory(firstDirPath);
				Directory.CreateDirectory(secondDirPath);
				File.WriteAllText(firstConfigFile, @"nonsense");
				Thread.Sleep(1000); // May help ensure write times are sufficiently different on TeamCity.
				File.WriteAllText(secondConfigFile, @"nonsense"); // second is newer

				var result = TestCrossPlatformSettingsProvider.VersionDirectoryComparison(firstDirPath, secondDirPath);
				Assert.That(result, Is.GreaterThan(0));

				Thread.Sleep(1000); // May help ensure write times are sufficiently different on TeamCity.
				File.WriteAllText(firstConfigFile, @"nonsense"); // now first is newer
				result = TestCrossPlatformSettingsProvider.VersionDirectoryComparison(firstDirPath, secondDirPath);
				Assert.That(result, Is.LessThan(0));

				// A final check to make sure it is really working the way we want
				var list = new List<string>();
				list.Add(secondDirPath);
				list.Add(firstDirPath);
				list.Sort(TestCrossPlatformSettingsProvider.VersionDirectoryComparison);
				Assert.That(list[0], Is.EqualTo(firstDirPath));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:31,代码来源:SettingsProviderTests.cs


示例5: Setup

		public void Setup()
		{
			var library = new Moq.Mock<CollectionSettings>();
			library.SetupGet(x => x.IsSourceCollection).Returns(false);
			library.SetupGet(x => x.Language2Iso639Code).Returns("en");
			library.SetupGet(x => x.Language1Iso639Code).Returns("xyz");
			library.SetupGet(x => x.XMatterPackName).Returns("Factory");

			ErrorReport.IsOkToInteractWithUser = false;
			_fileLocator = new FileLocator(new string[]
											{
												//FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"),
												BloomFileLocator.GetFactoryBookTemplateDirectory("Basic Book"),
												BloomFileLocator.GetFactoryBookTemplateDirectory("Wall Calendar"),
												FileLocator.GetDirectoryDistributedWithApplication( BloomFileLocator.BrowserRoot),
												BloomFileLocator.GetBrowserDirectory("bookLayout"),
												BloomFileLocator.GetBrowserDirectory("bookEdit","css"),
												BloomFileLocator.GetInstalledXMatterDirectory()
											});

			var projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection");
			var collectionSettings = new CollectionSettings(Path.Combine(projectFolder.Path, "test.bloomCollection"));

			_starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), library.Object);
			_shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection");
			_libraryFolder = new TemporaryFolder("BookStarterTests_LibraryCollection");
		}
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:27,代码来源:ConfiguratorTest.cs


示例6: TestEnvironment

			public TestEnvironment(string rfctag, string rfctag2)
			{
				_folder = new TemporaryFolder("WritingSystemsInoptionListFileHelper");
				var pathtoOptionsListFile1 = Path.Combine(_folder.Path, "test1.xml");
				_optionListFile = new IO.TempFile(String.Format(_optionListFileContent, rfctag, rfctag2));
				_optionListFile.MoveTo(pathtoOptionsListFile1);
			}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:7,代码来源:WritingSystemsInOptionsListFileHelperTests.cs


示例7: SettingsFolderWithNoConfig_SortsAfterOneWithConfig

		public void SettingsFolderWithNoConfig_SortsAfterOneWithConfig()
		{
			// We do two iterations like this to vary whether the (originally) first or last directory lacks
			// the config file. (We can't achieve this reliably by deleting the file because it sometimes
			// takes the system some time to notice that it is gone.)
			for (var which = 0; which < 1; which++)
			{
				using (var tempFolder = new TemporaryFolder())
				{
					var firstDirPath = Path.Combine(tempFolder.Path, "first");
					var secondDirPath = Path.Combine(tempFolder.Path, "second");
					var firstConfigFile = Path.Combine(firstDirPath, TestCrossPlatformSettingsProvider.UserConfigFileName);
					var secondConfigFile = Path.Combine(firstDirPath, TestCrossPlatformSettingsProvider.UserConfigFileName);
					Directory.CreateDirectory(firstDirPath);
					Directory.CreateDirectory(secondDirPath);
					if (which == 0)
						File.WriteAllText(firstConfigFile, @"nonsense");
					else
						File.WriteAllText(secondConfigFile, @"nonsense");

					var list = new List<string>();
					list.Add(secondDirPath);
					list.Add(firstDirPath);
					list.Sort(TestCrossPlatformSettingsProvider.VersionDirectoryComparison);
					if (which == 0)
						Assert.That(list[0], Is.EqualTo(firstDirPath), "first directory has config so should have come first");
					else
						Assert.That(list[0], Is.EqualTo(secondDirPath), "second directory has config so should have come first");
				}
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:31,代码来源:SettingsProviderTests.cs


示例8: Constructor_PathDirectoryName_CreatesTemporarySubDirectoryAtPathWithGivenName

		public void Constructor_PathDirectoryName_CreatesTemporarySubDirectoryAtPathWithGivenName()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder("Constructor_PathDirectoryName_CreatesTemporarySubDirectoryAtPathWithGivenName");
			Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:7,代码来源:TemporaryFolderTests.cs


示例9: Constructor_Path_CreatesTemporarySubDirectoryAtPath

		public void Constructor_Path_CreatesTemporarySubDirectoryAtPath()
		{
			using (TemporaryFolder temporaryFolder = new TemporaryFolder("foo"))
			{
				Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:7,代码来源:TemporaryFolderTests.cs


示例10: HgTestSetup

 public HgTestSetup()
 {
     _progress = new ConsoleProgress();
     Root = new TemporaryFolder("ChorusHgWrappingTest");
     HgRepository.CreateRepositoryInExistingDir(Root.Path,_progress);
     Repository = new HgRepository(Root.Path, new NullProgress());
 }
开发者ID:regnrand,项目名称:chorus,代码行数:7,代码来源:HgTestSetup.cs


示例11: TempLiftFile

		public TempLiftFile(string fileName, TemporaryFolder parentFolder, string xmlOfEntries, string claimedLiftVersion)
			: base(true) // True means "I'll set the the pathname, thank you very much." Otherwise, the temp one 'false' creates will stay forever, and fill the hard drive up.
		{
			_path = parentFolder.Combine(fileName);

			string liftContents = string.Format("<?xml version='1.0' encoding='utf-8'?><lift version='{0}'>{1}</lift>", claimedLiftVersion, xmlOfEntries);
			File.WriteAllText(_path, liftContents);
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:8,代码来源:TemporaryFolder.cs


示例12: Launch_CloseAfterAFewSeconds_DoesntCrash

 public void Launch_CloseAfterAFewSeconds_DoesntCrash()
 {
     using (var folder = new TemporaryFolder("ChorusApplicationTests"))
     {
         Application.Idle += new EventHandler(Application_Idle);
         new Program.Runner().Run(folder.Path, new Arguments(new object[]{}));
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:8,代码来源:ChorusApplicationTests.cs


示例13: GetTemporaryFile_FileExistsInTemporarySubdirectory

		public void GetTemporaryFile_FileExistsInTemporarySubdirectory()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder();
			string pathToFile = temporaryFolder.GetTemporaryFile();
			Assert.IsTrue(File.Exists(pathToFile));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:8,代码来源:TemporaryFolderTests.cs


示例14: TestEnvironment

			public TestEnvironment(string liftFileContent)
			{
				_folder = new TemporaryFolder("WritingSystemsInLiftFileHelper");
				var pathtoLiftFile1 = Path.Combine(_folder.Path, "test1.lift");
				_liftFile1 = new SIL.IO.TempFile(liftFileContent);
				_liftFile1.MoveTo(pathtoLiftFile1);
				Helper = new WritingSystemsInLiftFileHelper(WritingSystems, _liftFile1.Path);
			}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:8,代码来源:WritingSystemsInLiftFileHelperTests.cs


示例15: Constructor_CreatesFolders

		public void Constructor_CreatesFolders()
		{
			using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests"))
			{
				var repo = new GlobalWritingSystemRepository(e.Path);
				Assert.That(Directory.Exists(repo.PathToWritingSystems), Is.True);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:8,代码来源:GlobalWritingSystemRepositoryTests.cs


示例16: TestEnvironment

			public TestEnvironment()
			{
				FolderContainingLdml = new TemporaryFolder("LdmlInFolderMigratorTests");
				NamespaceManager = new XmlNamespaceManager(new NameTable());
				NamespaceManager.AddNamespace("sil", "urn://www.sil.org/ldml/0.1");
				NamespaceManager.AddNamespace("palaso", "urn://palaso.org/ldmlExtensions/v1");
				NamespaceManager.AddNamespace("palaso2", "urn://palaso.org/ldmlExtensions/v2");
			}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:8,代码来源:LdmlInFolderWritingSystemRepositoryMigratorTests.cs


示例17: LaunchDialog_CustomUrlSourceWontBeFound

 public void LaunchDialog_CustomUrlSourceWontBeFound()
 {
     using (var source = new TemporaryFolder("CloneDialogTest"))
     {
         Directory.CreateDirectory(source.Combine("repo1"));
         HgRepository.CreateRepositoryInExistingDir(source.Combine("repo1"), new NullProgress());
         LaunchCustomUrl(@"somewhereElse");
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:9,代码来源:GetCloneFromInternetDialogTests.cs


示例18: GetTemporaryFile_Name_FileWithNameExistsInTemporarySubdirectory

		public void GetTemporaryFile_Name_FileWithNameExistsInTemporarySubdirectory()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder();
			string pathToFile = temporaryFolder.GetTemporaryFile("blah");
			Assert.IsTrue(File.Exists(pathToFile));
			Assert.AreEqual(pathToFile, Path.Combine(temporaryFolder.Path, "blah"));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:9,代码来源:TemporaryFolderTests.cs


示例19: GetTemporaryFile_CalledTwice_BothFilesFoundInSameTemporarySubdirectory

		public void GetTemporaryFile_CalledTwice_BothFilesFoundInSameTemporarySubdirectory()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder();
			temporaryFolder.GetTemporaryFile();
			temporaryFolder.GetTemporaryFile();
			Assert.AreEqual(2, Directory.GetFiles(temporaryFolder.Path).Length);
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:9,代码来源:TemporaryFolderTests.cs


示例20: Constructor_WithExistingFolders_NoThrow

		public void Constructor_WithExistingFolders_NoThrow()
		{
			using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests"))
			{
				new GlobalWritingSystemRepository(e.Path);
				var repo2 = new GlobalWritingSystemRepository(e.Path);
				Assert.That(Directory.Exists(repo2.PathToWritingSystems), Is.True);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:9,代码来源:GlobalWritingSystemRepositoryTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Tool.PublicationInformation类代码示例发布时间:2022-05-26
下一篇:
C# DomainServices.AnalysisOccurrence类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap