diff options
author | Matt Ward <ward.matt@gmail.com> | 2015-03-26 14:12:59 +0300 |
---|---|---|
committer | Matt Ward <ward.matt@gmail.com> | 2015-03-26 14:17:54 +0300 |
commit | 69ecc8b592ef0e3032e5466400fcaf448a349ede (patch) | |
tree | f5ea775f3e95f6e4ecc31a048ba240429872d28a /main/src/addins/NUnit | |
parent | 7a8b1b0714c5a7db1c8d0b548b0865b79badcf62 (diff) |
[NUnit] Fix prompt always displayed when running NUnit project.
Fixed bug #28083 - When running an NUnit project, Xamarin Studio
always asks "An application is already running and will have to be
stopped. Do you want to continue?"
https://bugzilla.xamarin.com/show_bug.cgi?id=28083
When an NUnit project was run, either from the main toolbar menu or
from the Run menu, with Start Debugging or Start Without Debugging,
the NUnit addin was treating the running of the tests as a separate
run operation which would cause a prompt to be displayed to the user.
Now when the NUnit project is run the ProjectOperation's
CurrentRunOperation is not checked, nor modified by, the NUnit addin
since it is part of the CurrentRunOperation and not a separate
operation.
The user will still be prompted if they are debugging another project
in the solution and then try to run the unit tests from the Unit Tests
pad.
The NUnitProjectServiceExtension now uses code that was previously
commented out to fix bug #18130. With the change made to the
NUnitService to prevent it from changing the CurrentRunOperation
the bug 18138 is still fixed.
https://bugzilla.xamarin.com/show_bug.cgi?id=18130
Diffstat (limited to 'main/src/addins/NUnit')
-rw-r--r-- | main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs | 14 | ||||
-rw-r--r-- | main/src/addins/NUnit/Services/NUnitService.cs | 12 |
2 files changed, 16 insertions, 10 deletions
diff --git a/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs b/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs index 0ecd719fd8..d868a0fb66 100644 --- a/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs +++ b/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs @@ -44,14 +44,14 @@ namespace MonoDevelop.NUnit if (test != null) { IAsyncOperation oper = null; DispatchService.GuiSyncDispatch (delegate { - oper = NUnitService.Instance.RunTest (test, context.ExecutionHandler, false); + oper = NUnitService.Instance.RunTest (test, context.ExecutionHandler, false, false); }); -// if (oper != null) { -// monitor.CancelRequested += delegate { -// oper.Cancel (); -// }; -// oper.WaitForCompleted (); -// } + if (oper != null) { + monitor.CancelRequested += delegate { + oper.Cancel (); + }; + oper.WaitForCompleted (); + } } } } diff --git a/main/src/addins/NUnit/Services/NUnitService.cs b/main/src/addins/NUnit/Services/NUnitService.cs index cdcbfdbe3f..f04a634abd 100644 --- a/main/src/addins/NUnit/Services/NUnitService.cs +++ b/main/src/addins/NUnit/Services/NUnitService.cs @@ -107,6 +107,11 @@ namespace MonoDevelop.NUnit public IAsyncOperation RunTest (UnitTest test, IExecutionHandler context, bool buildOwnerObject) { + return RunTest (test, context, buildOwnerObject, true); + } + + internal IAsyncOperation RunTest (UnitTest test, IExecutionHandler context, bool buildOwnerObject, bool checkCurrentRunOperation) + { string testName = test.FullName; if (buildOwnerObject) { @@ -145,7 +150,7 @@ namespace MonoDevelop.NUnit } } - if (!IdeApp.ProjectOperations.ConfirmExecutionOperation ()) + if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation ()) return NullProcessAsyncOperation.Failure; Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>(); @@ -168,8 +173,9 @@ namespace MonoDevelop.NUnit }; session.Start (); - - IdeApp.ProjectOperations.CurrentRunOperation = session; + + if (checkCurrentRunOperation) + IdeApp.ProjectOperations.CurrentRunOperation = session; return session; } |