Ejemplo n.º 1
0
		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));
		}
Ejemplo n.º 2
0
		public void Constructor_CreatesTemporarySubDirectory()
		{
			var temporaryFolder = new TemporaryFolder();
			Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
		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));
		}
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
		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));
		}
Ejemplo n.º 7
0
		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));
		}
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
		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));
		}
Ejemplo n.º 12
0
        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();
			}
		}
Ejemplo n.º 14
0
 protected override void DisposeManagedResources()
 {
     Sldr.Cleanup();
     _sldrCacheFolder.Dispose();
 }
Ejemplo n.º 15
0
		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));
		}
Ejemplo n.º 16
0
		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));
		}