コード例 #1
0
        public virtual void TestDeleteNonexistentPathNonRecursive()
        {
            Path path = Path("testDeleteNonexistentPathNonRecursive");

            ContractTestUtils.AssertPathDoesNotExist(GetFileSystem(), "leftover", path);
            ContractTestUtils.RejectRootOperation(path);
            NUnit.Framework.Assert.IsFalse("Returned true attempting to recursively delete" +
                                           " a nonexistent path " + path, GetFileSystem().Delete(path, false));
        }
コード例 #2
0
        public virtual void TestDeleteNonEmptyDirNonRecursive()
        {
            Path path = Path("testDeleteNonEmptyDirNonRecursive");

            Mkdirs(path);
            Path file = new Path(path, "childfile");

            ContractTestUtils.WriteTextFile(GetFileSystem(), file, "goodbye, world", true);
            try
            {
                ContractTestUtils.RejectRootOperation(path);
                bool deleted = GetFileSystem().Delete(path, false);
                NUnit.Framework.Assert.Fail("non recursive delete should have raised an exception,"
                                            + " but completed with exit code " + deleted);
            }
            catch (IOException expected)
            {
                //expected
                HandleExpectedException(expected);
            }
            ContractTestUtils.AssertIsDirectory(GetFileSystem(), path);
        }