本文整理汇总了C#中SIL.TestUtilities.TemporaryFolder.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# TemporaryFolder.Dispose方法的具体用法?C# TemporaryFolder.Dispose怎么用?C# TemporaryFolder.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.TestUtilities.TemporaryFolder
的用法示例。
在下文中一共展示了TemporaryFolder.Dispose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
示例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));
}
示例3: 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));
}
示例4: 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));
}
示例5: 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));
}
示例6: Constructor_TemporarySubDirectoryAlreadyExistsAndHasFilesInIt_EmptyTheTemporarySubDirectory
public void Constructor_TemporarySubDirectoryAlreadyExistsAndHasFilesInIt_EmptyTheTemporarySubDirectory()
{
TemporaryFolder temporaryFolder = new TemporaryFolder("NonStandard");
string pathToFile = Path.Combine(temporaryFolder.Path, Path.GetRandomFileName());
FileStream file = File.Create(pathToFile);
file.Close();
TemporaryFolder temporaryFolderUsingSameDirectory = new TemporaryFolder("NonStandard");
Assert.AreEqual(0, Directory.GetFiles(temporaryFolder.Path).Length);
temporaryFolder.Dispose();
Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
Assert.IsFalse(Directory.Exists(temporaryFolderUsingSameDirectory.Path));
}
示例7: CreateRampPackageWithSessionArchiveAndMetsFile_CreatesRampPackage
public void CreateRampPackageWithSessionArchiveAndMetsFile_CreatesRampPackage()
{
TemporaryFolder tmpFolder = new TemporaryFolder("ArchiveHelperTestFolder");
try
{
string fileName = Path.Combine(tmpFolder.Path, "ddo.session");
File.CreateText(fileName).Close();
var fileList = new[] { Path.Combine(tmpFolder.Path, "ddo.session") };
_filesToAdd.Add(string.Empty, new Tuple<IEnumerable<string>, string>(fileList, "Message to display."));
_helper.Initialize();
_helper.CreateMetsFile();
Assert.IsTrue(_helper.CreateRampPackage());
Assert.IsTrue(File.Exists(_helper.PackagePath));
}
finally
{
tmpFolder.Dispose();
}
}
示例8: Delete_FileInDirectory_RemovesTemporaryDirectory
public void Delete_FileInDirectory_RemovesTemporaryDirectory()
{
TemporaryFolder temporaryFolder = new TemporaryFolder("NonStandard");
string pathToFile = Path.Combine(temporaryFolder.FolderPath, Path.GetRandomFileName());
FileStream file = File.Create(pathToFile);
file.Close();
temporaryFolder.Dispose();
Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
}
示例9: Delete_SubDirectoriesInDirectory_RemovesTemporaryDirectory
public void Delete_SubDirectoriesInDirectory_RemovesTemporaryDirectory()
{
TemporaryFolder temporaryFolder = new TemporaryFolder("NonStandard");
string pathToSubdirectory = Path.Combine(temporaryFolder.Path, Path.GetRandomFileName());
Directory.CreateDirectory(pathToSubdirectory);
temporaryFolder.Dispose();
Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
}