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


C# TestUtilities.TemporaryFolder类代码示例

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


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


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