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


C# TemporaryFolder.GetNewTempFile方法代码示例

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


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

示例1: AddingRepositoryWithinAnotherRepositoryWithEmptyStringDirectoryThrows

        public void AddingRepositoryWithinAnotherRepositoryWithEmptyStringDirectoryThrows()
        {
            using (var tempParent = new TemporaryFolder("ChorusParent"))
            {
                var parentRepo = new HgRepository(tempParent.Path, new NullProgress());
                parentRepo.Init();
                var parentFile = tempParent.GetNewTempFile(true);
                File.WriteAllText(parentFile.Path, "New Content");
                parentRepo.AddAndCheckinFile(parentFile.Path);

                Assert.Throws<ArgumentNullException>(() => HgRepository.CreateOrUseExisting("", new NullProgress()));
            }
        }
开发者ID:regnrand,项目名称:chorus,代码行数:13,代码来源:RepositoryTests.cs

示例2: AddingRepositoryWithinAnotherRepositoryWithNonexistantDirectoryThrows

        public void AddingRepositoryWithinAnotherRepositoryWithNonexistantDirectoryThrows()
        {
            using (var tempParent = new TemporaryFolder("ChorusParent"))
            {
                var parentRepo = new HgRepository(tempParent.Path, new NullProgress());
                parentRepo.Init();
                var parentFile = tempParent.GetNewTempFile(true);
                File.WriteAllText(parentFile.Path, "New Content");
                parentRepo.AddAndCheckinFile(parentFile.Path);

                var parentFolder = tempParent.Path;
                var nonexistantDirectory = Path.Combine(parentFolder, "Child");
                Assert.Throws<InvalidOperationException>(() => HgRepository.CreateOrUseExisting(nonexistantDirectory, new NullProgress()));
            }
        }
开发者ID:regnrand,项目名称:chorus,代码行数:15,代码来源:RepositoryTests.cs

示例3: AddingRepositoryWithinAnotherRepositoryFromDirectoryNameIsDifferentRepository

        public void AddingRepositoryWithinAnotherRepositoryFromDirectoryNameIsDifferentRepository()
        {
            using (var tempParent = new TemporaryFolder("ChorusParent"))
            {
                var parentRepo = new HgRepository(tempParent.Path, new NullProgress());
                parentRepo.Init();
                var parentFile = tempParent.GetNewTempFile(true);
                File.WriteAllText(parentFile.Path, "New Content");
                parentRepo.AddAndCheckinFile(parentFile.Path);

                var parentFolder = tempParent.Path;
                var dirInfo = Directory.CreateDirectory(Path.Combine(parentFolder, "Child"));
                var childRepo = HgRepository.CreateOrUseExisting(dirInfo.FullName, new NullProgress());
                Assert.AreNotEqual(parentFolder, childRepo.PathToRepo);
            }
        }
开发者ID:regnrand,项目名称:chorus,代码行数:16,代码来源:RepositoryTests.cs

示例4: GetRevisionWorkingSetIsBasedOn_OneCheckin_Gives0

 public void GetRevisionWorkingSetIsBasedOn_OneCheckin_Gives0()
 {
     using (var testRoot = new TemporaryFolder("ChorusHgWrappingTest"))
     {
         HgRepository.CreateRepositoryInExistingDir(testRoot.Path, _progress);
         var repo = new HgRepository(testRoot.Path, new NullProgress());
         using(var f = testRoot.GetNewTempFile(true))
         {
             repo.AddAndCheckinFile(f.Path);
             var rev = repo.GetRevisionWorkingSetIsBasedOn();
             Assert.AreEqual("0", rev.Number.LocalRevisionNumber);
             Assert.AreEqual(12, rev.Number.Hash.Length);
         }
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:15,代码来源:HgWrappingTests.cs

示例5: DirectoryIsEmpty_DirectoryContainsFile

		public void DirectoryIsEmpty_DirectoryContainsFile()
		{
			using (var tempDir = new TemporaryFolder("IsEmpty_DirectoryContainsFile"))
			{
				var file = tempDir.GetNewTempFile(false);
				File.WriteAllText(file.Path, @"Some test text");
				Assert.IsFalse(DirectoryUtilities.DirectoryIsEmpty(tempDir.Path));
				Assert.IsFalse(DirectoryUtilities.DirectoryIsEmpty(tempDir.Path, true));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:10,代码来源:DirectoryUtilitiesTests.cs

示例6: Setup

		public void Setup()
		{
			_tempfolder = new TemporaryFolder("LiftLexEntryRepositoryCachingTests");
			_tempFile = _tempfolder.GetNewTempFile(true);
			_repository = new LiftLexEntryRepository(_tempFile.Path);
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:6,代码来源:LexEntryRepositoryCachingTests.cs

示例7: RepositoryRecoversFromIncompleteMerge

 public void RepositoryRecoversFromIncompleteMerge()
 {
     using (var tempRepo = new TemporaryFolder("ChorusIncompleteMerge"))
     {
         var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
     #if MONO
         baseDir = baseDir.Replace(@"file:", null);
     #else
         baseDir = baseDir.Replace(@"file:\", null);
     #endif
         var zipFile = new ZipFile(Path.Combine(baseDir, Path.Combine("VcsDrivers", Path.Combine("TestData", "incompletemergerepo.zip"))));
         zipFile.ExtractAll(tempRepo.Path);
         var hgRepo = new HgRepository(tempRepo.Path, new NullProgress());
         hgRepo.CheckAndUpdateHgrc();
         var parentFile = tempRepo.GetNewTempFile(true);
         File.WriteAllText(parentFile.Path, "New Content");
         var exception = Assert.Throws<ApplicationException>(() => hgRepo.AddAndCheckinFile(parentFile.Path));
         Assert.That(exception.Message.Contains("Unable to recover") && !exception.Message.Contains("unresolved merge"),
             String.Format("Repository should have conflict in retrying the merge, but not have an incomplete merge: {0}", exception.Message));
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:21,代码来源:RepositoryTests.cs


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