Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vstest.console Should not message to Testhost process if it has exited #1994

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ public void StartTestRun(TestRunCriteriaWithTests runCriteria, ITestRunEventsHan
/// <inheritdoc />
public void SendTestRunCancel()
{
if (this.IsOperationComplete())
{
EqtTrace.Verbose("TestRequestSender: SendTestRunCancel: Operation is already complete. Skip error message.");
return;
}

if (EqtTrace.IsVerboseEnabled)
{
EqtTrace.Verbose("TestRequestSender.SendTestRunCancel: Sending test run cancel.");
Expand All @@ -331,6 +337,12 @@ public void SendTestRunCancel()
/// <inheritdoc />
public void SendTestRunAbort()
{
if (this.IsOperationComplete())
{
EqtTrace.Verbose("TestRequestSender: SendTestRunAbort: Operation is already complete. Skip error message.");
return;
}

if (EqtTrace.IsVerboseEnabled)
{
EqtTrace.Verbose("TestRequestSender.SendTestRunAbort: Sending test run abort.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,30 @@ public void EndSessionShouldNotSendSessionEndMessageIfTestHostProcessExited()
this.mockDataSerializer.Verify(ds => ds.SerializeMessage(MessageType.SessionEnd), Times.Once);
}

[TestMethod]
public void EndSessionShouldNotSendTestRunCancelMessageIfClientDisconnected()
{
this.SetupFakeCommunicationChannel();
this.testRequestSender.DiscoverTests(new DiscoveryCriteria(), this.mockDiscoveryEventsHandler.Object);
this.RaiseClientDisconnectedEvent();

this.testRequestSender.SendTestRunCancel();

this.mockChannel.Verify(mockChannel => mockChannel.Send(MessageType.CancelTestRun), Times.Never);
}

[TestMethod]
public void EndSessionShouldNotSendTestRunAbortMessageIfClientDisconnected()
{
this.SetupFakeCommunicationChannel();
this.testRequestSender.DiscoverTests(new DiscoveryCriteria(), this.mockDiscoveryEventsHandler.Object);
this.RaiseClientDisconnectedEvent();

this.testRequestSender.SendTestRunAbort();

this.mockChannel.Verify(mockChannel => mockChannel.Send(MessageType.CancelTestRun), Times.Never);
}

[DataTestMethod]
[DataRow("")]
[DataRow(" ")]
Expand Down