public virtual void TestNotDirectory() { System.IO.FileInfo path = new System.IO.FileInfo(System.IO.Path.Combine(SupportClass.AppSettings.Get("tempDir", ""), "testnotdir")); Directory fsDir = new SimpleFSDirectory(path, null); try { IndexOutput out_Renamed = fsDir.CreateOutput("afile"); out_Renamed.Close(); Assert.IsTrue(fsDir.FileExists("afile")); try { new SimpleFSDirectory(new System.IO.FileInfo(System.IO.Path.Combine(path.FullName, "afile")), null); Assert.Fail("did not hit expected exception"); } catch (NoSuchDirectoryException nsde) { // Expected } } finally { fsDir.Close(); _TestUtil.RmDir(path); } }
public virtual void TestNotDirectory() { System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(System.IO.Path.Combine(AppSettings.Get("tempDir", ""), "testnotdir")); Directory fsDir = new SimpleFSDirectory(path, null); try { IndexOutput out_Renamed = fsDir.CreateOutput("afile", null); out_Renamed.Close(); Assert.IsTrue(fsDir.FileExists("afile", null)); Assert.Throws <NoSuchDirectoryException>( () => new SimpleFSDirectory(new System.IO.DirectoryInfo(System.IO.Path.Combine(path.FullName, "afile")), null), "did not hit expected exception"); } finally { fsDir.Close(); _TestUtil.RmDir(path); } }
public virtual void TestNotDirectory() { System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(System.IO.Path.Combine(AppSettings.Get("tempDir", ""), "testnotdir")); Directory fsDir = new SimpleFSDirectory(path, null); try { IndexOutput out_Renamed = fsDir.CreateOutput("afile"); out_Renamed.Close(); Assert.IsTrue(fsDir.FileExists("afile")); Assert.Throws<NoSuchDirectoryException>( () => new SimpleFSDirectory(new System.IO.DirectoryInfo(System.IO.Path.Combine(path.FullName, "afile")), null), "did not hit expected exception"); } finally { fsDir.Close(); _TestUtil.RmDir(path); } }