From f471cc43b6dda515cbb50be6381d42ee4f84acb0 Mon Sep 17 00:00:00 2001 From: Abhitej John Date: Wed, 31 Jan 2018 06:32:58 -0800 Subject: [PATCH] Cancellation timing issue fix. (#1398) * Fix for a timing issue where a cancel request before test run request has been started is being ignored. We have the right plumbing in place but just seem to have missed initializing a var. Put that in place. All interface changes are internal only. --- .../Execution/TestRunRequest.cs | 4 ++-- .../ClientProtocol/IProxyExecutionManager.cs | 6 ++++-- .../TesthostProtocol/IExecutionManager.cs | 6 ++++-- .../Client/InProcessProxyexecutionManager.cs | 10 +++++---- .../Parallel/ParallelProxyExecutionManager.cs | 8 +++---- .../Client/ProxyExecutionManager.cs | 18 ++++++++++++++-- ...ProxyExecutionManagerWithDataCollection.cs | 4 ++-- .../EventHandlers/TestRequestHandler.cs | 4 ++-- .../Execution/ExecutionManager.cs | 21 +++++++------------ .../TestPlatformHelpers/TestRequestManager.cs | 9 ++++---- .../Execution/TestRunRequestTests.cs | 16 +++++++------- .../InProcessProxyexecutionManagerTests.cs | 8 +++---- .../ParallelProxyExecutionManagerTests.cs | 10 ++++----- .../Client/ProxyExecutionManagerTests.cs | 2 +- ...ExecutionManagerWithDataCollectionTests.cs | 4 ++-- .../EventHandlers/TestRequestHandlerTests.cs | 4 ++-- 16 files changed, 75 insertions(+), 59 deletions(-) diff --git a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs index 9c6a397a0e..a243eb7828 100644 --- a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs @@ -247,7 +247,7 @@ public void CancelAsync() else { // Inform the service about run cancellation - this.ExecutionManager.Cancel(); + this.ExecutionManager.Cancel(this); } } @@ -275,7 +275,7 @@ public void Abort() } else { - this.ExecutionManager.Abort(); + this.ExecutionManager.Abort(this); } } diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyExecutionManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyExecutionManager.cs index 46076e8510..c6b65ddccb 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyExecutionManager.cs @@ -31,12 +31,14 @@ public interface IProxyExecutionManager /// /// Cancels the test run. On the test host, this will send a message to adapters. /// - void Cancel(); + // EventHandler for handling execution events from Engine. + void Cancel(ITestRunEventsHandler eventHandler); /// /// Aborts the test operation. This will forcefully terminate the test host. /// - void Abort(); + // EventHandler for handling execution events from Engine. + void Abort(ITestRunEventsHandler eventHandler); /// /// Closes the current test operation by sending a end session message. diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs index 6d7667d46c..2576e5154f 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs @@ -49,11 +49,13 @@ public interface IExecutionManager /// /// Cancel the test execution. /// - void Cancel(); + /// EventHandler for handling execution events from Engine. + void Cancel(ITestRunEventsHandler testRunEventsHandler); /// /// Aborts the test execution. /// - void Abort(); + /// EventHandler for handling execution events from Engine. + void Abort(ITestRunEventsHandler testRunEventsHandler); } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs index 12f7196c00..bdebaaff5c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs @@ -109,17 +109,19 @@ public int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler e /// /// Aborts the test operation. /// - public void Abort() + /// EventHandler for handling execution events from Engine. + public void Abort(ITestRunEventsHandler eventHandler) { - Task.Run(() => this.testHostManagerFactory.GetExecutionManager().Abort()); + Task.Run(() => this.testHostManagerFactory.GetExecutionManager().Abort(eventHandler)); } /// /// Cancels the test run. /// - public void Cancel() + /// EventHandler for handling execution events from Engine. + public void Cancel(ITestRunEventsHandler eventHandler) { - Task.Run(() => this.testHostManagerFactory.GetExecutionManager().Cancel()); + Task.Run(() => this.testHostManagerFactory.GetExecutionManager().Cancel(eventHandler)); } /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index b1c889af95..74dd0c7c4f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -120,16 +120,16 @@ public int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler e return this.StartTestRunPrivate(eventHandler); } - public void Abort() + public void Abort(ITestRunEventsHandler runEventsHandler) { // Test platform initiated abort. abortRequested = true; - this.DoActionOnAllManagers((proxyManager) => proxyManager.Abort(), doActionsInParallel: true); + this.DoActionOnAllManagers((proxyManager) => proxyManager.Abort(runEventsHandler), doActionsInParallel: true); } - public void Cancel() + public void Cancel(ITestRunEventsHandler runEventsHandler) { - this.DoActionOnAllManagers((proxyManager) => proxyManager.Cancel(), doActionsInParallel: true); + this.DoActionOnAllManagers((proxyManager) => proxyManager.Cancel(runEventsHandler), doActionsInParallel: true); } public void Close() diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 36f20a1276..af9ef23454 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -168,8 +168,15 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH /// /// Cancels the test run. /// - public virtual void Cancel() + /// EventHandler for handling execution events from Engine. + public virtual void Cancel(ITestRunEventsHandler eventHandler) { + // Just in case ExecuteAsync isn't called yet, set the eventhandler + if(this.baseTestRunEventsHandler == null) + { + this.baseTestRunEventsHandler = eventHandler; + } + // Cancel fast, try to stop testhost deployment/launch this.cancellationTokenSource.Cancel(); if (this.isCommunicationEstablished) @@ -187,8 +194,15 @@ public virtual int LaunchProcessWithDebuggerAttached(TestProcessStartInfo testPr /// /// Aborts the test run. /// - public void Abort() + /// EventHandler for handling execution events from Engine. + public void Abort(ITestRunEventsHandler eventHandler) { + // Just in case ExecuteAsync isn't called yet, set the eventhandler + if(this.baseTestRunEventsHandler == null) + { + this.baseTestRunEventsHandler = eventHandler; + } + this.RequestSender.SendTestRunAbort(); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs index c6ead60592..9b651e36f5 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs @@ -122,7 +122,7 @@ public override int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEvents } /// - public override void Cancel() + public override void Cancel(ITestRunEventsHandler eventHandler) { try { @@ -130,7 +130,7 @@ public override void Cancel() } finally { - base.Cancel(); + base.Cancel(eventHandler); } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs index 7989de7478..70bf98c54a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs @@ -321,7 +321,7 @@ public void OnMessageReceived(object sender, MessageReceivedEventArgs messageRec case MessageType.CancelTestRun: jobQueue.Pause(); this.testHostManagerFactoryReady.Wait(); - testHostManagerFactory.GetExecutionManager().Cancel(); + testHostManagerFactory.GetExecutionManager().Cancel(new TestRunEventsHandler(this)); break; case MessageType.LaunchAdapterProcessWithDebuggerAttachedCallback: @@ -331,7 +331,7 @@ public void OnMessageReceived(object sender, MessageReceivedEventArgs messageRec case MessageType.AbortTestRun: jobQueue.Pause(); this.testHostManagerFactoryReady.Wait(); - testHostManagerFactory.GetExecutionManager().Abort(); + testHostManagerFactory.GetExecutionManager().Abort(new TestRunEventsHandler(this)); break; case MessageType.SessionEnd: diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs index 909b1793f8..815ae614cc 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs @@ -22,8 +22,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution /// public class ExecutionManager : IExecutionManager { - private ITestRunEventsHandler testRunEventsHandler; - private readonly ITestPlatformEventSource testPlatformEventSource; private BaseRunTests activeTestRun; @@ -85,7 +83,6 @@ public void StartTestRun( ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { - this.testRunEventsHandler = runEventsHandler; try { this.activeTestRun = new RunTestsWithSources(this.requestData, adapterSourceMap, package, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); @@ -94,8 +91,8 @@ public void StartTestRun( } catch(Exception e) { - this.testRunEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); - this.Abort(); + runEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); + this.Abort(runEventsHandler); } finally { @@ -120,8 +117,6 @@ public void StartTestRun( ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { - this.testRunEventsHandler = runEventsHandler; - try { this.activeTestRun = new RunTestsWithTests(this.requestData, tests, package, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); @@ -130,8 +125,8 @@ public void StartTestRun( } catch(Exception e) { - this.testRunEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); - this.Abort(); + runEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); + this.Abort(runEventsHandler); } finally { @@ -142,12 +137,12 @@ public void StartTestRun( /// /// Cancel the test execution. /// - public void Cancel() + public void Cancel(ITestRunEventsHandler testRunEventsHandler) { if (this.activeTestRun == null) { var testRunCompleteEventArgs = new TestRunCompleteEventArgs(null, true, false, null, null, TimeSpan.Zero); - this.testRunEventsHandler.HandleTestRunComplete(testRunCompleteEventArgs, null, null, null); + testRunEventsHandler.HandleTestRunComplete(testRunCompleteEventArgs, null, null, null); } else { @@ -158,12 +153,12 @@ public void Cancel() /// /// Aborts the test execution. /// - public void Abort() + public void Abort(ITestRunEventsHandler testRunEventsHandler) { if (this.activeTestRun == null) { var testRunCompleteEventArgs = new TestRunCompleteEventArgs(null, false, true, null, null, TimeSpan.Zero); - this.testRunEventsHandler.HandleTestRunComplete(testRunCompleteEventArgs, null, null, null); + testRunEventsHandler.HandleTestRunComplete(testRunCompleteEventArgs, null, null, null); } else { diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index acaf2f339c..80bd5f2bb1 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -60,7 +60,7 @@ internal class TestRequestManager : ITestRequestManager /// private ITestRunRequest currentTestRunRequest; - private readonly EventWaitHandle runRequestCreatedEventHandle = new AutoResetEvent(false); + private readonly EventWaitHandle runRequestStartedEventHandle = new AutoResetEvent(false); private object syncobject = new object(); @@ -322,7 +322,7 @@ public void CancelTestRun() { EqtTrace.Info("TestRequestManager.CancelTestRun: Sending cancel request."); - this.runRequestCreatedEventHandle.WaitOne(runRequestTimeout); + this.runRequestStartedEventHandle.WaitOne(runRequestTimeout); this.currentTestRunRequest?.CancelAsync(); } @@ -333,7 +333,7 @@ public void AbortTestRun() { EqtTrace.Info("TestRequestManager.AbortTestRun: Sending abort request."); - this.runRequestCreatedEventHandle.WaitOne(runRequestTimeout); + this.runRequestStartedEventHandle.WaitOne(runRequestTimeout); this.currentTestRunRequest?.Abort(); } @@ -457,7 +457,6 @@ private bool RunTests(IRequestData requestData, TestRunCriteria testRunCriteria, try { this.currentTestRunRequest = this.testPlatform.CreateTestRunRequest(requestData, testRunCriteria); - this.runRequestCreatedEventHandle.Set(); this.testLoggerManager.RegisterTestRunEvents(this.currentTestRunRequest); this.testRunResultAggregator.RegisterTestRunEvents(this.currentTestRunRequest); @@ -466,6 +465,8 @@ private bool RunTests(IRequestData requestData, TestRunCriteria testRunCriteria, this.testPlatformEventSource.ExecutionRequestStart(); this.currentTestRunRequest.ExecuteAsync(); + + this.runRequestStartedEventHandle.Set(); // Wait for the run completion event this.currentTestRunRequest.WaitForCompletion(); diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs index fd29863473..b0556d5d41 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs @@ -106,7 +106,7 @@ public void AbortIfTestRunStateIsNotInProgressShouldNotCallExecutionManagerAbort { //ExecuteAsync has not been called, so State is not InProgress testRunRequest.Abort(); - executionManager.Verify(dm => dm.Abort(), Times.Never); + executionManager.Verify(dm => dm.Abort(It.IsAny()), Times.Never); } [TestMethod] @@ -116,7 +116,7 @@ public void AbortIfDiscoveryIsinProgressShouldCallDiscoveryManagerAbort() testRunRequest.ExecuteAsync(); testRunRequest.Abort(); - executionManager.Verify(dm => dm.Abort(), Times.Once); + executionManager.Verify(dm => dm.Abort(It.IsAny()), Times.Once); } [TestMethod] @@ -143,7 +143,7 @@ public void CancelAsyncIfTestRunRequestDisposedShouldNotThrowException() public void CancelAsyncIfTestRunStateNotInProgressWillNotCallExecutionManagerCancel() { testRunRequest.CancelAsync(); - executionManager.Verify(dm => dm.Cancel(), Times.Never); + executionManager.Verify(dm => dm.Cancel(It.IsAny()), Times.Never); } [TestMethod] @@ -151,7 +151,7 @@ public void CancelAsyncIfTestRunStateInProgressCallsExecutionManagerCancel() { testRunRequest.ExecuteAsync(); testRunRequest.CancelAsync(); - executionManager.Verify(dm => dm.Cancel(), Times.Once); + executionManager.Verify(dm => dm.Cancel(It.IsAny()), Times.Once); } @@ -160,7 +160,7 @@ public void OnTestSessionTimeoutShouldCallAbort() { this.testRunRequest.ExecuteAsync(); this.testRunRequest.OnTestSessionTimeout(null); - this.executionManager.Verify(o => o.Abort(), Times.Once); + this.executionManager.Verify(o => o.Abort(It.IsAny()), Times.Once); } [TestMethod] @@ -202,12 +202,12 @@ public void OnTestSessionTimeoutShouldGetCalledWhenExecutionCrossedTestSessionTi ManualResetEvent onTestSessionTimeoutCalled = new ManualResetEvent(true); onTestSessionTimeoutCalled.Reset(); - executionManager.Setup(o => o.Abort()).Callback(() => onTestSessionTimeoutCalled.Set()); + executionManager.Setup(o => o.Abort(It.IsAny())).Callback(() => onTestSessionTimeoutCalled.Set()); testRunRequest.ExecuteAsync(); onTestSessionTimeoutCalled.WaitOne(20 * 1000); - executionManager.Verify(o => o.Abort(), Times.Once); + executionManager.Verify(o => o.Abort(It.IsAny()), Times.Once); } /// @@ -232,7 +232,7 @@ public void OnTestSessionTimeoutShouldNotGetCalledWhenTestSessionTimeoutIsZero() testRunRequest.ExecuteAsync(); - executionManager.Verify(o => o.Abort(), Times.Never); + executionManager.Verify(o => o.Abort(It.IsAny()), Times.Never); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs index bff4c4f365..47851d21e7 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs @@ -179,10 +179,10 @@ public void AbortShouldCallExecutionManagerAbort() { var manualResetEvent = new ManualResetEvent(true); - this.mockExecutionManager.Setup(o => o.Abort()).Callback( + this.mockExecutionManager.Setup(o => o.Abort(It.IsAny())).Callback( () => manualResetEvent.Set()); - this.inProcessProxyExecutionManager.Abort(); + this.inProcessProxyExecutionManager.Abort(It.IsAny()); Assert.IsTrue(manualResetEvent.WaitOne(5000), "IExecutionManager.Abort should get called"); } @@ -192,10 +192,10 @@ public void CancelShouldCallExecutionManagerCancel() { var manualResetEvent = new ManualResetEvent(true); - this.mockExecutionManager.Setup(o => o.Cancel()).Callback( + this.mockExecutionManager.Setup(o => o.Cancel(It.IsAny())).Callback( () => manualResetEvent.Set()); - this.inProcessProxyExecutionManager.Cancel(); + this.inProcessProxyExecutionManager.Cancel(It.IsAny()); Assert.IsTrue(manualResetEvent.WaitOne(5000), "IExecutionManager.Abort should get called"); } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs index 504381e9d8..186f4ee97e 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs @@ -89,10 +89,10 @@ public void AbortShouldCallAllConcurrentManagersOnce() { var parallelExecutionManager = new ParallelProxyExecutionManager(this.mockRequestData.Object, this.proxyManagerFunc, 4); - parallelExecutionManager.Abort(); + parallelExecutionManager.Abort(It.IsAny()); Assert.AreEqual(4, createdMockManagers.Count, "Number of Concurrent Managers created should be 4"); - createdMockManagers.ForEach(em => em.Verify(m => m.Abort(), Times.Once)); + createdMockManagers.ForEach(em => em.Verify(m => m.Abort(It.IsAny()), Times.Once)); } [TestMethod] @@ -100,10 +100,10 @@ public void CancelShouldCallAllConcurrentManagersOnce() { var parallelExecutionManager = new ParallelProxyExecutionManager(this.mockRequestData.Object, this.proxyManagerFunc, 4); - parallelExecutionManager.Cancel(); + parallelExecutionManager.Cancel(It.IsAny()); Assert.AreEqual(4, createdMockManagers.Count, "Number of Concurrent Managers created should be 4"); - createdMockManagers.ForEach(em => em.Verify(m => m.Cancel(), Times.Once)); + createdMockManagers.ForEach(em => em.Verify(m => m.Cancel(It.IsAny()), Times.Once)); } [TestMethod] @@ -215,7 +215,7 @@ public void StartTestRunShouldNotProcessAllSourcesOnExecutionAborted() this.SetupMockManagers(this.processedSources, isCanceled: false, isAborted: false); SetupHandleTestRunComplete(this.executionCompleted); - parallelExecutionManager.Abort(); + parallelExecutionManager.Abort(It.IsAny()); Task.Run(() => { parallelExecutionManager.StartTestRun(this.testRunCriteriaWithSources, this.mockHandler.Object); }); Assert.IsTrue(this.executionCompleted.Wait(taskTimeout), "Test run not completed."); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs index ad2f27fe6d..694f81dfb0 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs @@ -387,7 +387,7 @@ public void CancelShouldNotSendSendTestRunCancelIfCommunicationFails() this.testExecutionManager.StartTestRun(this.mockTestRunCriteria.Object, mockTestRunEventsHandler.Object); - this.testExecutionManager.Cancel(); + this.testExecutionManager.Cancel(It.IsAny()); this.mockRequestSender.Verify(s => s.SendTestRunCancel(), Times.Never); } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs index bbcd5ee79e..84c2086197 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs @@ -115,7 +115,7 @@ public void InitializeShouldSaveExceptionMessagesIfThrownByDataCollectionProcess [TestMethod] public void CancelShouldInvokeAfterTestCaseEnd() { - this.proxyExecutionManager.Cancel(); + this.proxyExecutionManager.Cancel(It.IsAny()); this.mockDataCollectionManager.Verify(x => x.AfterTestRunEnd(true, It.IsAny()), Times.Once); } @@ -127,7 +127,7 @@ public void CancelShouldThrowExceptionIfThrownByProxyDataCollectionManager() Assert.ThrowsException(() => { - this.proxyExecutionManager.Cancel(); + this.proxyExecutionManager.Cancel(It.IsAny()); }); } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs index 8a0061b411..e286f6ab67 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs @@ -285,7 +285,7 @@ public void ProcessRequestsExecutionCancelShouldCancelTestRun() this.ProcessRequestsAsync(this.mockTestHostManagerFactory.Object); this.SendMessageOnChannel(message); - mockExecutionManager.Verify(e => e.Cancel()); + mockExecutionManager.Verify(e => e.Cancel(It.IsAny())); this.SendSessionEnd(); } @@ -313,7 +313,7 @@ public void ProcessRequestsExecutionAbortShouldStopTestRun() this.ProcessRequestsAsync(this.mockTestHostManagerFactory.Object); this.SendMessageOnChannel(message); - mockExecutionManager.Verify(e => e.Abort()); + mockExecutionManager.Verify(e => e.Abort(It.IsAny())); this.SendSessionEnd(); }