/// <exception cref="System.IO.IOException"/> public virtual void TestCreateFileAndMkdirs() { Path test_dir = new Path(TestRootDir, "test_dir"); Path test_file = new Path(test_dir, "file1"); Assert.True(fileSys.Mkdirs(test_dir)); int fileSize = new Random().Next(1 << 20) + 1; FileSystemTestHelper.WriteFile(fileSys, test_file, fileSize); { //check FileStatus and ContentSummary FileStatus status = fileSys.GetFileStatus(test_file); Assert.Equal(fileSize, status.GetLen()); ContentSummary summary = fileSys.GetContentSummary(test_dir); Assert.Equal(fileSize, summary.GetLength()); } // creating dir over a file Path bad_dir = new Path(test_file, "another_dir"); try { fileSys.Mkdirs(bad_dir); NUnit.Framework.Assert.Fail("Failed to detect existing file in path"); } catch (ParentNotDirectoryException) { } // Expected try { fileSys.Mkdirs(null); NUnit.Framework.Assert.Fail("Failed to detect null in mkdir arg"); } catch (ArgumentException) { } }