Exemplo n.º 1
0
        public void Delete1()
        {
            string path = Path.Combine(Path.GetTempPath(), "CadruTest");
            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            Assert.IsFalse(Directory.Exists(path), "Unable to delete the test directory.");

            ExtendedDirectoryInfo edi = new ExtendedDirectoryInfo(path);
            Assert.IsNotNull(edi);

            string path2 = edi.CreateSubdirectory("Subdir").FullName;
            Assert.IsTrue(Directory.Exists(path));

            File.WriteAllText(Path.Combine(path2, "testfile.txt"), "This is a test.");
            edi.Delete(true);

            Assert.IsFalse(Directory.Exists(path), "Unable to delete the test directory.");
        }
Exemplo n.º 2
0
        public void Delete()
        {
            string path = Path.Combine(Path.GetTempPath(), "CadruTest");
            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            Assert.IsFalse(Directory.Exists(path), "Unable to delete the test directory.");

            ExtendedDirectoryInfo edi = new ExtendedDirectoryInfo(path);
            Assert.IsNotNull(edi);

            edi.Create();
            Assert.IsTrue(Directory.Exists(path));

            edi.Delete();

            Assert.IsFalse(Directory.Exists(path), "Unable to delete the test directory.");
        }