Skip to content

Commit 7a83a59

Browse files
committed
Fix GivenDotnetTestBuildsAndRunsTestFromCsproj tests
1 parent 582359a commit 7a83a59

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public GivenDotnetTestBuildsAndRunsTestFromCsproj(ITestOutputHelper log) : base(
1818
[Fact]
1919
public void MSTestSingleTFM()
2020
{
21-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("3");
21+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
2222

2323
// Call test
2424
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true)
@@ -160,7 +160,7 @@ public void GivenAFailingTestItDisplaysFailureDetails()
160160
public void ItAcceptsMultipleLoggersAsCliArguments()
161161
{
162162
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
163-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("10");
163+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
164164
var trxFileNamePattern = "custom*.trx";
165165
string trxLoggerDirectory = Path.Combine(testProjectDirectory, "RD");
166166

@@ -197,7 +197,7 @@ public void ItAcceptsMultipleLoggersAsCliArguments()
197197
public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
198198
{
199199
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
200-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("5");
200+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
201201
string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
202202
string expectedError = Path.Combine(testProjectDirectory, "bin",
203203
configuration, ToolsetInfo.CurrentTargetFramework, "VSTestCore.dll");
@@ -225,7 +225,7 @@ public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
225225
public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch()
226226
{
227227
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
228-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("6");
228+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
229229

230230
string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TR", "x.y");
231231

@@ -256,7 +256,7 @@ public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch()
256256
public void ItCreatesTrxReportInTheSpecifiedResultsDirectoryByArgs()
257257
{
258258
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
259-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("7");
259+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
260260
var trxFileNamePattern = "custom*.trx";
261261
string trxLoggerDirectory = Path.Combine(testProjectDirectory, "RD");
262262

@@ -342,7 +342,7 @@ public void ItBuildsAndTestsAppWhenRestoringToSpecificDirectory()
342342
public void ItUsesVerbosityPassedToDefineVerbosityOfConsoleLoggerOfTheTests(string verbosity, bool shouldShowPassedTests)
343343
{
344344
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
345-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp($"9_{verbosity}");
345+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([verbosity, shouldShowPassedTests]);
346346

347347
// Call test
348348
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true)
@@ -414,7 +414,7 @@ public void ItTestsWithTheSpecifiedRuntimeOption()
414414
public void ItAcceptsNoLogoAsCliArguments()
415415
{
416416
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
417-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("14");
417+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
418418

419419
// Call test with logger enable
420420
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true)
@@ -434,7 +434,7 @@ public void ItAcceptsNoLogoAsCliArguments()
434434
[PlatformSpecificFact(TestPlatforms.Windows)]
435435
public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings()
436436
{
437-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("11");
437+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
438438

439439
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
440440

@@ -475,7 +475,7 @@ public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings()
475475
[PlatformSpecificFact(TestPlatforms.Windows | TestPlatforms.OSX | TestPlatforms.Linux)]
476476
public void ItCreatesCoverageFileInResultsDirectory()
477477
{
478-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("12");
478+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
479479

480480
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
481481

@@ -511,7 +511,7 @@ public void ItCreatesCoverageFileInResultsDirectory()
511511
[PlatformSpecificFact(TestPlatforms.Windows | TestPlatforms.OSX | TestPlatforms.Linux)]
512512
public void ItCreatesCoberturaFileProvidedByCommandInResultsDirectory()
513513
{
514-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("15");
514+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
515515

516516
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
517517

@@ -547,7 +547,7 @@ public void ItCreatesCoberturaFileProvidedByCommandInResultsDirectory()
547547
[PlatformSpecificFact(TestPlatforms.Windows)]
548548
public void ItHandlesMultipleCollectCommandInResultsDirectory()
549549
{
550-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("16");
550+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
551551

552552
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
553553

@@ -588,7 +588,7 @@ public void ItHandlesMultipleCollectCommandInResultsDirectory()
588588
[PlatformSpecificFact(TestPlatforms.FreeBSD)]
589589
public void ItShouldShowWarningMessageOnCollectCodeCoverage()
590590
{
591-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("13");
591+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]);
592592

593593
// Call test
594594
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true)
@@ -714,7 +714,7 @@ public void FilterPropertyCorrectlyHandlesComma(string filter, string folderSuff
714714
[InlineData("--results-directory")]
715715
public void EnsureOutputPathEscaped(string flag)
716716
{
717-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp(flag);
717+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([flag]);
718718

719719
var pathWithComma = Path.Combine(AppContext.BaseDirectory, "a,b");
720720

@@ -763,7 +763,7 @@ public void PathEndsWithSlashOrBackslash(string flag, string slashesOrBackslashe
763763
{
764764
// NOTE: We also want to test with forward slashes because on Windows they
765765
// are converted to backslashes and so need to be handled correctly.
766-
string testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp(Guid.NewGuid().ToString());
766+
string testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([flag, slashesOrBackslashes]);
767767
string flagDirectory = Path.Combine(testProjectDirectory, "flag-dir");
768768

769769
// Call test
@@ -788,7 +788,7 @@ public void PathEndsWithSlashOrBackslash(string flag, string slashesOrBackslashe
788788
[InlineData("-e:foo=barexe")]
789789
public void ArgumentsEndWithDllOrExeShouldNotFail(string arg)
790790
{
791-
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp();
791+
var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([arg]);
792792

793793
// Call test
794794
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true)
@@ -804,12 +804,12 @@ public void ArgumentsEndWithDllOrExeShouldNotFail(string arg)
804804
}
805805
}
806806

807-
private string CopyAndRestoreVSTestDotNetCoreTestApp([CallerMemberName] string callingMethod = "")
807+
private string CopyAndRestoreVSTestDotNetCoreTestApp(object[] parameters, [CallerMemberName] string callingMethod = "")
808808
{
809809
// Copy VSTestCore project in output directory of project dotnet-vstest.Tests
810810
string testAppName = "VSTestCore";
811811

812-
var testInstance = _testAssetsManager.CopyTestAsset(testAppName, callingMethod: callingMethod)
812+
var testInstance = _testAssetsManager.CopyTestAsset(testAppName, callingMethod: callingMethod, identifier: string.Join(",", parameters.Select(p => p.ToString())))
813813
.WithSource()
814814
.WithVersionVariables();
815815

0 commit comments

Comments
 (0)