本文整理汇总了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()));
}
}
示例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()));
}
}
示例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);
}
}
示例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);
}
}
}
示例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));
}
}
示例6: Setup
public void Setup()
{
_tempfolder = new TemporaryFolder("LiftLexEntryRepositoryCachingTests");
_tempFile = _tempfolder.GetNewTempFile(true);
_repository = new LiftLexEntryRepository(_tempFile.Path);
}
示例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));
}
}