Skip to content

Commit

Permalink
Close discovery manager on request complete. (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
codito authored Sep 23, 2016
1 parent 2bbf394 commit d9dbd28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ public void HandleDiscoveryComplete(long totalTests, IEnumerable<TestCase> lastC
}

this.discoveryInProgress = false;

// Close the discovery session
this.DiscoveryManager?.Close();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.UnitTests.Discovery
{
using System;
using System.Collections.Generic;
using System.Linq;

using Client.Discovery;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;

using ObjectModel;
using ObjectModel.Client;
using ObjectModel.Engine;

Expand Down Expand Up @@ -99,5 +101,15 @@ public void WaitForCompletionIfDiscoveryRequestDisposedShouldThrowObjectDisposed
this.discoveryRequest.Dispose();
Assert.ThrowsException<ObjectDisposedException>(() => this.discoveryRequest.WaitForCompletion());
}

[TestMethod]
public void HandleDiscoveryCompleteShouldCloseDiscoveryManager()
{
var eventsHandler = this.discoveryRequest as ITestDiscoveryEventsHandler;

eventsHandler.HandleDiscoveryComplete(1, Enumerable.Empty<TestCase>(), false);

this.discoveryManager.Verify(dm => dm.Close(), Times.Once);
}
}
}

0 comments on commit d9dbd28

Please sign in to comment.