Fixes #1314. TextView now exposes file exceptions from callers.

This commit is contained in:
BDisp
2021-07-11 19:10:44 +01:00
parent 3c1fa5f2b1
commit 3da689ff31
2 changed files with 32 additions and 21 deletions

View File

@@ -7,7 +7,7 @@ namespace Terminal.Gui.Views {
public class TextViewTests {
private static TextView _textView;
// This class enables test functions annoated with the [InitShutdown] attribute
// This class enables test functions annotated with the [InitShutdown] attribute
// to have a function called before the test function is called and after.
//
// This is necessary because a) Application is a singleton and Init/Shutdown must be called
@@ -1751,5 +1751,27 @@ namespace Terminal.Gui.Views {
return col;
}
[Fact]
public void LoadFile_Throws_If_File_Is_Null ()
{
var tv = new TextView ();
Assert.Throws<ArgumentNullException> (() => tv.LoadFile (null));
}
[Fact]
public void LoadFile_Throws_If_File_Is_Empty ()
{
var tv = new TextView ();
Assert.Throws<ArgumentException> (() => tv.LoadFile (""));
}
[Fact]
public void CloseFile_Throws_If_FilePath_Is_Null ()
{
var tv = new TextView ();
Assert.Throws<ArgumentNullException> (() => tv.CloseFile ());
}
}
}