Example #1
0
        public void CleanUpRemovesDirectory()
        {
            using (var temporaryDirectory = new TemporaryDirectory())
            {
                Assume.That(temporaryDirectory.FullPath, Does.Exist);

                temporaryDirectory.CleanUp();

                Assert.That(temporaryDirectory.FullPath, Does.Not.Exist);
            }
        }
Example #2
0
        public void CleanUpRemovesNotEmptyDirectory()
        {
            using (var temporaryDirectory = new TemporaryDirectory())
            {
                Assume.That(temporaryDirectory.FullPath, Does.Exist);
                File.WriteAllText(Path.Combine(temporaryDirectory.FullPath, "test.txt"), "");

                temporaryDirectory.CleanUp();

                Assert.That(temporaryDirectory.FullPath, Does.Not.Exist);
            }
        }