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)); }
public void Constructor_CreatesTemporarySubDirectory() { var temporaryFolder = new TemporaryFolder(); Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath)); temporaryFolder.Dispose(); Assert.IsFalse(Directory.Exists(temporaryFolder.Path)); }
public void Constructor_CreatesTemporarySubDirectory() { var temporaryFolder = new TemporaryFolder(TestContext.CurrentContext.Test.Name); Assert.IsTrue(Directory.Exists(temporaryFolder.Path)); temporaryFolder.Dispose(); Assert.IsFalse(Directory.Exists(temporaryFolder.Path)); }
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)); }
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)); }
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)); }
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)); }
public void Delete_FileInDirectory_RemovesTemporaryDirectory() { TemporaryFolder temporaryFolder = new TemporaryFolder("NonStandard"); string pathToFile = Path.Combine(temporaryFolder.Path, Path.GetRandomFileName()); FileStream file = File.Create(pathToFile); file.Close(); temporaryFolder.Dispose(); Assert.IsFalse(Directory.Exists(temporaryFolder.Path)); }
public void GetTemporaryFile_FileExistsInTemporarySubdirectory() { TemporaryFolder temporaryFolder = new TemporaryFolder(TestContext.CurrentContext.Test.Name); #pragma warning disable 618 string pathToFile = temporaryFolder.GetTemporaryFile(); #pragma warning restore 618 Assert.IsTrue(File.Exists(pathToFile)); temporaryFolder.Dispose(); Assert.IsFalse(Directory.Exists(temporaryFolder.Path)); }
public void GetTemporaryFile_CalledTwice_BothFilesFoundInSameTemporarySubdirectory() { TemporaryFolder temporaryFolder = new TemporaryFolder(TestContext.CurrentContext.Test.Name); #pragma warning disable 618 temporaryFolder.GetTemporaryFile(); temporaryFolder.GetTemporaryFile(); #pragma warning restore 618 Assert.AreEqual(2, Directory.GetFiles(temporaryFolder.Path).Length); temporaryFolder.Dispose(); Assert.IsFalse(Directory.Exists(temporaryFolder.Path)); }
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)); }
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(); } }
protected override void DisposeManagedResources() { Sldr.Cleanup(); _sldrCacheFolder.Dispose(); }
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)); }