當前位置: 首頁>>代碼示例>>C#>>正文


C# TemporaryFolder.GetNewTempFile方法代碼示例

本文整理匯總了C#中Palaso.TestUtilities.TemporaryFolder.GetNewTempFile方法的典型用法代碼示例。如果您正苦於以下問題:C# TemporaryFolder.GetNewTempFile方法的具體用法?C# TemporaryFolder.GetNewTempFile怎麽用?C# TemporaryFolder.GetNewTempFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Palaso.TestUtilities.TemporaryFolder的用法示例。


在下文中一共展示了TemporaryFolder.GetNewTempFile方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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:sillsdev,項目名稱:chack,代碼行數: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:sillsdev,項目名稱:chack,代碼行數: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:sillsdev,項目名稱:chack,代碼行數: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:sillsdev,項目名稱:chack,代碼行數: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:JohnThomson,項目名稱:libpalaso,代碼行數:10,代碼來源:DirectoryUtilitiesTests.cs

示例6: 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"), "Repository should have conflict in retrying the merge, but not have an incomplete merge");
     }
 }
開發者ID:JessieGriffin,項目名稱:chorus,代碼行數:20,代碼來源:RepositoryTests.cs


注:本文中的Palaso.TestUtilities.TemporaryFolder.GetNewTempFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。