Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubch1 committed Jun 16, 2020
1 parent 3176175 commit 89f7eed
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
16 changes: 16 additions & 0 deletions test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;

using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces;
Expand Down Expand Up @@ -302,6 +304,20 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync(
this.mockRequestSender.Verify(rs => rs.StartTestRunWithCustomHostAsync(this.testCases, "RunSettings", options, It.IsAny<ITestRunEventsHandler>(), It.IsAny<ITestHostLauncher>()), Times.Once);
}

[TestMethod]
public async Task FinalizeMultiTestRunAsyncShouldSucceed()
{
var attachments = new Collection<AttachmentSet>();
var cancellationToken = new CancellationToken();

await this.consoleWrapper.FinalizeMultiTestRunAsync(
attachments,
new Mock<IMultiTestRunFinalizationEventsHandler>().Object,
cancellationToken);

this.mockRequestSender.Verify(rs => rs.FinalizeMultiTestRunAsync(attachments, It.IsAny<IMultiTestRunFinalizationEventsHandler>(), cancellationToken));
}

[TestMethod]
public void EndSessionShouldSucceed()
{
Expand Down
17 changes: 17 additions & 0 deletions test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests
using Moq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;

[TestClass]
public class VsTestConsoleWrapperTests
Expand Down Expand Up @@ -303,6 +306,20 @@ public void RunTestsWithSelectedTestsAndOptionsUsingACustomHostShouldPassOnOptio
this.mockRequestSender.Verify(rs => rs.StartTestRunWithCustomHost(this.testCases, "RunSettings", options, It.IsAny<ITestRunEventsHandler>(), It.IsAny<ITestHostLauncher>()), Times.Once);
}

[TestMethod]
public async Task FinalizeMultiTestRunAsyncShouldSucceed()
{
var attachments = new Collection<AttachmentSet>();
var cancellationToken = new CancellationToken();

await this.consoleWrapper.FinalizeMultiTestRunAsync(
attachments,
new Mock<IMultiTestRunFinalizationEventsHandler>().Object,
cancellationToken);

this.mockRequestSender.Verify(rs => rs.FinalizeMultiTestRunAsync(attachments, It.IsAny<IMultiTestRunFinalizationEventsHandler>(), cancellationToken));
}

[TestMethod]
public void EndSessionShouldSucceed()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public TestRequestManagerTests()

this.mockMetricsPublisher = new Mock<IMetricsPublisher>();
this.mockMetricsPublisherTask = Task.FromResult(this.mockMetricsPublisher.Object);
this.mockFinalizationManager = new Mock<IMultiTestRunFinalizationManager>();
this.testRequestManager = new TestRequestManager(
this.commandLineOptions,
this.mockTestPlatform.Object,
Expand All @@ -102,8 +103,7 @@ public TestRequestManagerTests()
this.mockAssemblyMetadataProvider.Setup(a => a.GetFrameWork(It.IsAny<string>()))
.Returns(new FrameworkName(Constants.DotNetFramework40));
this.mockProcessHelper.Setup(x => x.GetCurrentProcessId()).Returns(1234);
this.mockProcessHelper.Setup(x => x.GetProcessName(It.IsAny<int>())).Returns("dotnet.exe");
this.mockFinalizationManager = new Mock<IMultiTestRunFinalizationManager>();
this.mockProcessHelper.Setup(x => x.GetProcessName(It.IsAny<int>())).Returns("dotnet.exe");
}

[TestCleanup]
Expand Down

0 comments on commit 89f7eed

Please sign in to comment.