diff options
author | Matt Ward <ward.matt@gmail.com> | 2015-03-18 16:39:33 +0300 |
---|---|---|
committer | Matt Ward <ward.matt@gmail.com> | 2015-03-18 16:42:27 +0300 |
commit | a8a7389179acc7653dde5138eca53d5dc196a3f5 (patch) | |
tree | a1a23935d14c212b58f3d2f65f5ec02a3b3de45a /main/src/addins/NUnit | |
parent | de00e91bce2bcb37c882ff7e1dad70ef951148b4 (diff) |
[NUnit] Fix Go to failure menu always enabled in Unit Tests pad.
Fixed bug 28005 - 'Go to Failure' option is not working after right
click on Test project and tests.cs file
https://bugzilla.xamarin.com/show_bug.cgi?id=28005
Now the Go to Failure menu is only enabled if a test is selected and
it has failed. Previously the menu would always be enabled for any
tree node in the Unit Tests pad.
Diffstat (limited to 'main/src/addins/NUnit')
-rw-r--r-- | main/src/addins/NUnit/Gui/TestNodeBuilder.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/main/src/addins/NUnit/Gui/TestNodeBuilder.cs b/main/src/addins/NUnit/Gui/TestNodeBuilder.cs index e83a1463ed..7166e6b610 100644 --- a/main/src/addins/NUnit/Gui/TestNodeBuilder.cs +++ b/main/src/addins/NUnit/Gui/TestNodeBuilder.cs @@ -174,6 +174,22 @@ namespace MonoDevelop.NUnit UnitTest test = CurrentNode.DataItem as UnitTest; info.Enabled = test.SourceCodeLocation != null; } + + [CommandUpdateHandler (TestCommands.GoToFailure)] + protected void OnUpdateGoToFailure (CommandInfo info) + { + UnitTest test = CurrentNode.DataItem as UnitTest; + info.Enabled = IsGoToFailureEnabled (test); + } + + bool IsGoToFailureEnabled (UnitTest test) + { + if (test.SourceCodeLocation == null || test is UnitTestGroup) + return false; + + UnitTestResult res = test.GetLastResult (); + return res != null && res.IsFailure; + } [CommandUpdateHandler (ProjectCommands.Options)] protected void OnUpdateShowOptions (CommandInfo info) |