File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
TestCentric.Gui.Tests/Presenters/Main
TestCentric.Gui/Presenters Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 1111
1212namespace TestCentric . Gui . Presenters . Main
1313{
14+ using System . Runtime . InteropServices ;
15+ using System . Runtime . InteropServices . ComTypes ;
1416 using Elements ;
1517 using Model ;
1618 using NUnit . Common ;
@@ -95,6 +97,17 @@ public void OpenTestCentricProjectCommand_NoFileSelected_DoesNotCreateProject(st
9597 _model . DidNotReceiveWithAnyArgs ( ) . OpenExistingProject ( null ) ;
9698 }
9799
100+ [ Test ]
101+ public void OpenTestCentricProjectCommand_ThrowsException_ErrorMessage_IsDisplayed ( )
102+ {
103+ _view . DialogManager . GetFileOpenPath ( null , null ) . ReturnsForAnyArgs ( "Test.dll" ) ;
104+ _model . When ( m => m . OpenExistingProject ( "Test.dll" ) ) . Do ( x => throw new IOException ( "Disk error" ) ) ;
105+
106+ _view . OpenTestCentricProjectCommand . Execute += Raise . Event < CommandHandler > ( ) ;
107+
108+ _view . MessageDisplay . Received ( ) . Error ( Arg . Any < string > ( ) ) ;
109+ }
110+
98111 [ Test ]
99112 public void OpenTestCentricProjectCommand_IsEnabled ( )
100113 {
Original file line number Diff line number Diff line change @@ -589,8 +589,16 @@ private void OpenTestCentricProject()
589589 var filter = "TestCentric Projects (*.tcproj)|*.tcproj" ;
590590
591591 string file = _view . DialogManager . GetFileOpenPath ( "Existing Project" , filter ) ;
592- if ( ! string . IsNullOrEmpty ( file ) )
593- _model . OpenExistingProject ( file ) ;
592+
593+ try
594+ {
595+ if ( ! string . IsNullOrEmpty ( file ) )
596+ _model . OpenExistingProject ( file ) ;
597+ }
598+ catch ( Exception exception )
599+ {
600+ _view . MessageDisplay . Error ( "Unable to open project\n \n " + MessageBuilder . FromException ( exception ) ) ;
601+ }
594602 }
595603
596604 private void OpenTestAssembly ( )
You can’t perform that action at this time.
0 commit comments