diff --git a/Directory.Packages.props b/Directory.Packages.props index eca68c8c53b..0d372dfc926 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,6 +10,7 @@ 8.0.5 2.0.0-beta7.25374.102 3.4.3 + 3.2.2 @@ -73,7 +74,7 @@ - + @@ -104,9 +105,11 @@ --> - + + + - + - $(NoWarn);CS1701;xUnit1012;xUnit1014;xUnit2000;xUnit2009;xUnit2013 + Exe + $(NoWarn);CS1701;xUnit1012;xUnit1014;xUnit1051;xUnit2000;xUnit2009;xUnit2013;xUnit2031 $(WarningsAsErrors);xUnit2024 - + diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/CommandRunnerTest.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/CommandRunnerTest.cs index 1e1c80f5700..efe30cadbfc 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/CommandRunnerTest.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/CommandRunnerTest.cs @@ -12,7 +12,6 @@ using NuGet.Common; using NuGet.Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest { @@ -73,7 +72,7 @@ public void Run_CanGetExitCode() fileName, arguments: args, timeOutInMilliseconds: 10000, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); result.ExitCode.Should().Be(16); } @@ -103,7 +102,7 @@ public void Run_CanWriteToStandardInput() writer.WriteLine("echo Hello & exit 0"); }, timeOutInMilliseconds: 5000, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); result.Output.Should().Contain("Hello"); } @@ -154,7 +153,7 @@ public void Run_DoesNotHangWhenReadingLargeStdout(int outputSizeInKilobytes) fileName, Directory.GetCurrentDirectory(), args, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, result.ExitCode); @@ -193,7 +192,7 @@ public void Run_TimesOut() Stopwatch stopwatch = Stopwatch.StartNew(); - new Action(() => CommandRunner.Run(fileName, arguments: args, timeOutInMilliseconds: 1000, testOutputHelper: _testOutputHelper, timeoutRetryCount: 0)) + new Action(() => CommandRunner.Run(fileName, arguments: args, timeOutInMilliseconds: 1000, logLine: _testOutputHelper.WriteLine, timeoutRetryCount: 0)) .Should().Throw(); stopwatch.Stop(); @@ -224,7 +223,7 @@ private void VerifyWithCommandRunner() fileName, Directory.GetCurrentDirectory(), args, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, result.ExitCode); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/InstallCommandTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/InstallCommandTests.cs index 50b5cde381d..24a453a9dfe 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/InstallCommandTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/InstallCommandTests.cs @@ -13,7 +13,6 @@ using NuGet.Test.Utility; using Test.Utility.Signing; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest.Commands { @@ -249,7 +248,7 @@ public CommandRunnerResult RunInstall(string nugetExe, SimpleTestPathContext pat pathContext.WorkingDirectory, string.Join(" ", args), environmentVariables: envVars, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(expectedExitCode == r.ExitCode, r.AllOutput); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs index da84161cc08..c7b11944f1f 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs @@ -14,7 +14,6 @@ using NuGet.Test.Utility; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest.Commands { @@ -73,7 +72,7 @@ public void PushCommand_AllowsTimeoutToBeSpecifiedHigherThan100Seconds() pathContext.WorkingDirectory, $"push {sourcePath} -Source {server.Uri}push -Timeout 110", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert Assert.True(result.Success, $"{result.Output} {result.Errors}"); @@ -117,7 +116,7 @@ public void PushCommand_AllowsTimeoutToBeSpecifiedLowerThan100Seconds() pathContext.WorkingDirectory, $"push {sourcePath} -Source {server.Uri}push -Timeout 1", timeOutInMilliseconds: 20 * 1000, - testOutputHelper: _testOutputHelper); // 20 seconds + logLine: _testOutputHelper.WriteLine); // 20 seconds } // Assert @@ -158,7 +157,7 @@ public void PushCommand_Server_SkipDuplicate_NotSpecified_PushHalts() pathContext.WorkingDirectory, $"push {sourcePath} -Source {server.Uri}push -Timeout 110", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds //Run again so that it will be a duplicate push. result2 = CommandRunner.Run( @@ -166,14 +165,14 @@ public void PushCommand_Server_SkipDuplicate_NotSpecified_PushHalts() pathContext.WorkingDirectory, $"push {sourcePath} -Source {server.Uri}push -Timeout 110", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds result3 = CommandRunner.Run( nuget, pathContext.WorkingDirectory, $"push {sourcePath2} -Source {server.Uri}push -Timeout 110", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -224,7 +223,7 @@ public void PushCommand_Server_SkipDuplicate_IsSpecified_PushProceeds() pathContext.WorkingDirectory, $"push {sourcePath} -Source {server.Uri}push -Timeout 110 -SkipDuplicate", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds //Run again so that it will be a duplicate push but use the option to skip duplicate packages. result2 = CommandRunner.Run( @@ -232,7 +231,7 @@ public void PushCommand_Server_SkipDuplicate_IsSpecified_PushProceeds() pathContext.WorkingDirectory, $"push {sourcePath} -Source {server.Uri}push -Timeout 110 -SkipDuplicate", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds //Third run with a different package. result3 = CommandRunner.Run( @@ -240,7 +239,7 @@ public void PushCommand_Server_SkipDuplicate_IsSpecified_PushProceeds() pathContext.WorkingDirectory, $"push {sourcePath2} -Source {server.Uri}push -Timeout 110 -SkipDuplicate", timeOutInMilliseconds: 120 * 1000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -287,7 +286,7 @@ public void PushCommand_Server_Snupkg_ByFilename_DoesNotExist_FileNotFoundError( pathContext.WorkingDirectory, $"push {snupkgToPush} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -324,7 +323,7 @@ public void PushCommand_Server_Snupkg_ByWildcard_FindsNothing_FileNotFoundError( pathContext.WorkingDirectory, $"push {snupkgToPush} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } //Assert @@ -359,7 +358,7 @@ public void PushCommand_Server_Nupkg_ByFilename_FindsNothing_FileNotFoundError() pathContext.WorkingDirectory, $"push {nupkgToPush} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } //Assert @@ -394,7 +393,7 @@ public void PushCommand_Server_Nupkg_ByWildcard_FindsNothing_FileNotFoundError() pathContext.WorkingDirectory, $"push {nupkgToPush} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } //Assert @@ -438,7 +437,7 @@ public void PushCommand_Server_Nupkg_ByFilename_SnupkgDoesNotExist_NoFileNotFoun pathContext.WorkingDirectory, $"push {nupkgFullPath} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -479,7 +478,7 @@ public void PushCommand_Server_Nupkg_ByWildcard_SnupkgDoesNotExist_NoFileNotFoun pathContext.WorkingDirectory, $"push {pushArgument} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -531,7 +530,7 @@ public void PushCommand_Server_Nupkg_ByFilename_SnupkgExists_Conflict() pathContext.WorkingDirectory, $"push {nupkgFullPath} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds //Second run with SkipDuplicate result2 = CommandRunner.Run( @@ -539,7 +538,7 @@ public void PushCommand_Server_Nupkg_ByFilename_SnupkgExists_Conflict() pathContext.WorkingDirectory, $"push {nupkgFullPath} -Source {sourceName} -Timeout 110 -SkipDuplicate", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -599,7 +598,7 @@ public void PushCommand_Server_Nupkg_ByWildcard_NupkgAndSnupkgPushed() pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -655,7 +654,7 @@ public void PushCommand_Server_Nupkg_ByWildcard_SeparateSymbolUrl_NupkgAndSnupkg pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -SymbolSource {symbolSourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -711,7 +710,7 @@ public void PushCommand_Server_Nupkg_SeparateSymbolUrl_NoSymbolTrue_SnupkgNotPus pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -SymbolSource {symbolPushUrl} -noSymbol -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -766,7 +765,7 @@ public void PushCommand_Server_Nupkg_ByWildcard_FindsMatchingSnupkgs_Conflict() pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -SymbolSource {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -830,7 +829,7 @@ public void PushCommand_Server_Nupkg_ByWildcard_FindsMatchingSnupkgs_SkipDuplica pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -Timeout 110 -SkipDuplicate", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -890,7 +889,7 @@ public void PushCommand_Server_Snupkg_ByWildcard_FindsMatchingSnupkgs_Conflict() pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -Timeout 110", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -953,7 +952,7 @@ public void PushCommand_Server_Snupkg_ByWildcard_FindsMatchingSnupkgs_SkipDuplic pathContext.WorkingDirectory, $"push {wildcardPush} -Source {sourceName} -Timeout 110 -SkipDuplicate", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -1006,14 +1005,14 @@ public void PushCommand_Server_Snupkg_ByFilename_SnupkgExists_Conflict_ServerMes pathContext.WorkingDirectory, $"push {snupkgFileName} -Source {sourceName} -Timeout 110 -Verbosity detailed", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds result2 = CommandRunner.Run( nuget, pathContext.WorkingDirectory, $"push {snupkgFileName} -Source {sourceName} -Timeout 110 -SkipDuplicate -Verbosity detailed", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds } // Assert @@ -1045,7 +1044,7 @@ public void PushCommand_WhenPushingToAnHttpServerV3_WithSymbols_Errors() packageDirectory, $"push {snupkgFileName} -Source {sourceName} -Timeout 110 -Verbosity detailed", timeOutInMilliseconds: 120000, - testOutputHelper: _testOutputHelper); // 120 seconds + logLine: _testOutputHelper.WriteLine); // 120 seconds // Assert Assert.False(result.Success, result.AllOutput); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandSignPackagesTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandSignPackagesTests.cs index 140f10e281e..546890a139a 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandSignPackagesTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandSignPackagesTests.cs @@ -19,7 +19,6 @@ using NuGet.Test.Utility; using Test.Utility.Signing; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest.Commands { @@ -435,7 +434,7 @@ public CommandRunnerResult RunRestore(string nugetExe, SimpleTestPathContext pat pathContext.WorkingDirectory, string.Join(" ", args), environmentVariables: envVars, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(expectedExitCode == r.ExitCode, r.AllOutput); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandTests.cs index efdb5de7758..cb221c5b0e0 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/RestoreCommandTests.cs @@ -23,7 +23,6 @@ using NuGet.Versioning; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest.Commands { @@ -987,7 +986,7 @@ public CommandRunnerResult RunRestore(SimpleTestPathContext pathContext, int exp pathContext.WorkingDirectory.Path, string.Join(" ", args), environmentVariables: envVars, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(expectedExitCode == r.ExitCode, r.AllOutput); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SearchCommandTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SearchCommandTests.cs index 1e577f99e41..b39d1a915de 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SearchCommandTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SearchCommandTests.cs @@ -11,7 +11,6 @@ using NuGet.Test.Utility; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest.Commands { @@ -122,7 +121,7 @@ public void SearchCommand_TargetEndpointTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -232,7 +231,7 @@ public void SearchCommand_VerbosityDetailedTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -346,7 +345,7 @@ public void SearchCommand_VerbosityNormalTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -460,7 +459,7 @@ public void SearchCommand_VerbosityQuietTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -626,7 +625,7 @@ public void SearchCommand_TakeOptionTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -736,7 +735,7 @@ public void SearchCommand_SourceOptionTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -846,7 +845,7 @@ public void SearchCommand_MultipleSearchTermsTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -915,7 +914,7 @@ public void SearchCommand_NoResultsFoundTest() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -983,7 +982,7 @@ public void SearchCommand_WhenSearchWithHttpSource_DisplaysAnErrorMessage() nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server.Stop(); @@ -1094,7 +1093,7 @@ public void SearchCommand_WhenSearchWithHttpSourcesWithAllowInsecureConnections_ nugetexe, config.WorkingDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); server1.Stop(); server2.Stop(); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SignCommandTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SignCommandTests.cs index afe1d0d6ce5..8e1a3481793 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SignCommandTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/SignCommandTests.cs @@ -13,7 +13,6 @@ using NuGet.Packaging.Signing; using NuGet.Test.Utility; using Xunit; -using Xunit.Abstractions; using HashAlgorithmName = NuGet.Common.HashAlgorithmName; namespace NuGet.CommandLine.FuncTest.Commands @@ -71,7 +70,7 @@ public async Task SignCommand_SignPackageAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -105,7 +104,7 @@ public async Task SignCommand_SignPackageWithInvalidEkuFailsAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {invalidEkuCert.StoreName} -CertificateStoreLocation {invalidEkuCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeFalse(); @@ -139,7 +138,7 @@ public async Task SignCommand_SignPackageWithExpiredCertificateFailsAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {expiredCert.StoreName} -CertificateStoreLocation {expiredCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeFalse(); @@ -174,7 +173,7 @@ public async Task SignCommand_SignPackageWithNotYetValidCertificateFailsAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeFalse(); @@ -209,7 +208,7 @@ public async Task SignCommand_SignPackageWithTimestampingAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation} -Timestamper {timestampService.Url.OriginalString}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -243,7 +242,7 @@ public async Task SignCommand_SignPackageWithValidCertChainAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -277,7 +276,7 @@ public async Task SignCommand_SignPackageWithRevokedLeafCertChainAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeFalse(); @@ -311,7 +310,7 @@ public async Task SignCommand_SignPackageWithUnknownRevocationCertChainAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -349,7 +348,7 @@ public async Task SignCommand_SignPackageWithOutputDirectoryAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation} -OutputDirectory {outputDir}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -382,14 +381,14 @@ public async Task SignCommand_ResignPackageWithoutOverwriteFailsAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Act var secondResult = CommandRunner.Run( _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeTrue(); @@ -424,13 +423,13 @@ public async Task SignCommand_ResignPackageWithOverwriteSuccessAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); var secondResult = CommandRunner.Run( _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation} -Overwrite", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeTrue(); @@ -465,7 +464,7 @@ public async Task SignCommand_SignPackageWithOverwriteSuccessAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation} -Overwrite", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeTrue(); @@ -506,7 +505,7 @@ public async Task SignCommand_SignPackageWithPfxFileSuccessAsync() _nugetExePath, dir, $"sign {packagePath} -CertificatePath {pfxPath} -CertificatePassword {password}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeTrue(); @@ -551,7 +550,7 @@ public async Task SignCommand_SignPackageWithPfxFileInteractiveSuccessAsync() { w.WriteLine(password); }, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeTrue(); @@ -596,7 +595,7 @@ public async Task SignCommand_SignPackageWithPfxFileInteractiveInvalidPasswordFa { w.WriteLine(Guid.NewGuid().ToString()); }, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeFalse(); @@ -637,7 +636,7 @@ public async Task SignCommand_SignPackageWithPfxFileWithoutPasswordAndWithNonInt _nugetExePath, dir, $"sign {packagePath} -CertificatePath {pfxPath} -NonInteractive", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeFalse(); @@ -682,7 +681,7 @@ public async Task SignCommand_SignPackageWithPfxFileWithNonInteractiveAndStdInPa { w.WriteLine(Guid.NewGuid().ToString()); }, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert firstResult.Success.Should().BeFalse(); @@ -706,7 +705,7 @@ public async Task SignCommand_SignPackageWithUntrustedSelfIssuedCertificateInCer _nugetExePath, directory, $"sign {packageFile.FullName} -CertificateFingerprint {certSha256Hash}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(result.Success); Assert.Contains(_noTimestamperWarningCode, result.AllOutput); @@ -737,7 +736,7 @@ public async Task SignCommand_SignPackageWithUnsuportedTimestampHashAlgorithm_Sh _nugetExePath, directory, $"sign {packageFile.FullName} -CertificateFingerprint {certSha256Hash} -Timestamper {timestampService.Url}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.False(result.Success); Assert.Contains(_timestampUnsupportedDigestAlgorithmCode, result.AllOutput); @@ -794,7 +793,7 @@ private async Task ExecuteSignPackageTestWithCertificateFin _nugetExePath, directory, $"sign {packageFile.FullName} -CertificateFingerprint {certFingerprint} -Timestamper {timestampService.Url}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); return result; } diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/TrustedSignersCommandTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/TrustedSignersCommandTests.cs index 8f255111c7b..2b71cc5c7e3 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/TrustedSignersCommandTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/TrustedSignersCommandTests.cs @@ -19,7 +19,6 @@ using NuGet.Test.Utility; using Test.Utility.Signing; using Xunit; -using Xunit.Abstractions; using static NuGet.Commands.TrustedSignersArgs; namespace NuGet.CommandLine.FuncTest.Commands @@ -143,7 +142,7 @@ public void TrustedSignersCommand_Failure_InvalidArguments_HelpMessage(string ar _nugetExePath, Directory.GetCurrentDirectory(), $"trusted-signers {args}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert @@ -182,7 +181,7 @@ public void TrustedSignersCommand_AddTrustedSigner_WithCertificiateFingerprint_A _nugetExePath, dir, $"trusted-signers add -Name signer -CertificateFingerprint abcdefg -FingerprintAlgorithm SHA256 {allowUntrustedRootArg} -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeTrue(); @@ -229,7 +228,7 @@ public void TrustedSignersCommand_AddTrustedSigner_WithExistingSigner_UpdatesItS _nugetExePath, dir, $"trusted-signers add -Name signer -CertificateFingerprint hijklmn -FingerprintAlgorithm SHA256 {allowUntrustedRootArg} -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeTrue(); @@ -278,7 +277,7 @@ public async Task TrustedSignersCommand_AddTrustedSigner_WithAuthorSignedPackage _nugetExePath, dir, $"trusted-signers add {signedPackagePath} -Name signer -Author {allowUntrustedRootArg} -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeTrue(); @@ -329,7 +328,7 @@ public async Task TrustedSignersCommand_AddTrustedSigner_WithAuthorSignedPackage _nugetExePath, dir, $"trusted-signers add {multiplePackagesPath} -Name signer -Author {allowUntrustedRootArg} -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeFalse(); @@ -379,7 +378,7 @@ public async Task TrustedSignersCommand_AddTrustedSigner_WithRepositorySignedPac _nugetExePath, dir, $"trusted-signers add {signedPackagePath} -Name signer -Repository {allowUntrustedRootArg} {ownersArgs} -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeTrue(); @@ -441,7 +440,7 @@ public async Task TrustedSignersCommand_AddTrustedSigner_WithRepositoryCountersi _nugetExePath, dir, $"trusted-signers add {signedPackagePath} -Name signer -Repository {allowUntrustedRootArg} {ownersArgs} -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeTrue(); @@ -486,7 +485,7 @@ public void TrustedSignersCommand_RemoveTrustedSigner_RemovesItSuccessfullyFromC _nugetExePath, dir, $"trusted-signers remove -Name signer -Config {nugetConfigPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert commandResult.Success.Should().BeTrue(); diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/VerifyCommandTests.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/VerifyCommandTests.cs index f2479400bde..f2c04cfe9ce 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/VerifyCommandTests.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/VerifyCommandTests.cs @@ -13,7 +13,6 @@ using NuGet.Test.Utility; using Test.Utility.Signing; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest.Commands { @@ -64,7 +63,7 @@ public async Task VerifyCommand_VerifySignedPackageSucceedsAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); signResult.Success.Should().BeTrue(); @@ -73,7 +72,7 @@ public async Task VerifyCommand_VerifySignedPackageSucceedsAsync() _nugetExePath, dir, $"verify {packagePath} -Signatures", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeTrue(); @@ -106,7 +105,7 @@ public async Task VerifyCommand_VerifySignedAndTimestampedPackageSucceedsAsync() _nugetExePath, dir, $"sign {packagePath} -Timestamper {timestampService.Url.OriginalString} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); signResult.Success.Should().BeTrue(); @@ -115,7 +114,7 @@ public async Task VerifyCommand_VerifySignedAndTimestampedPackageSucceedsAsync() _nugetExePath, dir, $"verify {packagePath} -Signatures", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeTrue(); @@ -146,13 +145,13 @@ public async Task VerifyCommand_VerifyResignedPackageSucceedsAsync() _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); var secondResult = CommandRunner.Run( _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {_trustedTestCert.StoreName} -CertificateStoreLocation {_trustedTestCert.StoreLocation} -Overwrite", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); firstResult.Success.Should().BeTrue(); secondResult.Success.Should().BeTrue(); @@ -162,7 +161,7 @@ public async Task VerifyCommand_VerifyResignedPackageSucceedsAsync() _nugetExePath, dir, $"verify {packagePath} -Signatures", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeTrue(); @@ -195,7 +194,7 @@ public async Task VerifyCommand_VerifyOnPackageSignedWithValidCertificateChainSu _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); signResult.Success.Should().BeTrue(); @@ -204,7 +203,7 @@ public async Task VerifyCommand_VerifyOnPackageSignedWithValidCertificateChainSu _nugetExePath, dir, $"verify {packagePath} -Signatures", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeTrue(); @@ -237,7 +236,7 @@ public async Task VerifyCommand_VerifyOnPackageSignedWithAllowedCertificateSucce _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); signResult.Success.Should().BeTrue(); @@ -246,7 +245,7 @@ public async Task VerifyCommand_VerifyOnPackageSignedWithAllowedCertificateSucce _nugetExePath, dir, $"verify {packagePath} -Signatures -CertificateFingerprint {certSha256Hash};abc;def", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeTrue(); @@ -279,7 +278,7 @@ public async Task VerifyCommand_VerifyOnPackageSignedWithoutAllowedCertificateFa _nugetExePath, dir, $"sign {packagePath} -CertificateFingerprint {certSha256Hash} -CertificateStoreName {cert.StoreName} -CertificateStoreLocation {cert.StoreLocation}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); signResult.Success.Should().BeTrue(); @@ -288,7 +287,7 @@ public async Task VerifyCommand_VerifyOnPackageSignedWithoutAllowedCertificateFa _nugetExePath, dir, $"verify {packagePath} -Signatures -CertificateFingerprint abc;def", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeFalse(); @@ -333,7 +332,7 @@ public async Task Verify_AuthorSignedPackage_WithAuthorItemTrustedCertificate_Su _nugetExePath, testDirectory, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // For certificate with trusted root setting allowUntrustedRoot to true/false doesn't matter @@ -378,7 +377,7 @@ public async Task Verify_AuthorSignedPackage_WithRepositoryItemTrustedCertificat _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeFalse(because: verifyResult.AllOutput); @@ -425,7 +424,7 @@ public async Task Verify_RepositorySignedPackage_WithAuthorItemUntrustedCertific _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert verifyResult.Success.Should().BeFalse(because: verifyResult.AllOutput); @@ -479,7 +478,7 @@ public async Task Verify_RepositorySignedPackage_WithRepositoryItemUntrustedCert _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // Unless allowUntrustedRoot is set true in nuget.config verify always fails for cert without trusted root. @@ -525,7 +524,7 @@ public async Task Verify_RepositorySignedPackage_WithRepositoryItemUntrustedCert _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // If allowUntrustedRoot is set true in nuget.config then verify succeeds for cert with untrusted root. @@ -576,7 +575,7 @@ public async Task Verify_RepositorySignedPackage_WithRepositoryItemUntrustedCert _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // Owners is casesensitive, owner info should be "nuget;contoso" not "Nuget;Contoso" @@ -626,7 +625,7 @@ public async Task Verify_RepositorySignedPackage_WithRepositoryItemUntrustedCert _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // Owners is casesensitive, here owner "nuget" matches @@ -676,7 +675,7 @@ public async Task Verify_RepositorySignedPackage_WithRepositoryItemTrustedCertif _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // Owners is casesensitive, owner info should be "nuget;contoso" not "Nuget;Contoso" @@ -725,7 +724,7 @@ public async Task Verify_RepositorySignedPackage_WithRepositoryItemTrustedCertif _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -Signatures {fingerprint}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // For certificate with trusted root setting allowUntrustedRoot value true/false doesn't matter. @@ -769,7 +768,7 @@ public async Task VerifyCommand_AuthorSignedPackage_WithUntrustedCertificate_All _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -All -CertificateFingerprint {certificateFingerprintString};def -ConfigFile {nugetConfigPath2}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // allowUntrustedRoot is not set true in nuget2.config, but in nuget.config, so verify fails. @@ -812,7 +811,7 @@ public async Task VerifyCommand_AuthorSignedPackage_WithUntrustedCertificate_All _nugetExePath, pathContext.PackageSource, $"verify {signedPackagePath} -All -CertificateFingerprint {certificateFingerprintString};def -ConfigFile {nugetConfigPath2}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert // allowUntrustedRoot is set true in nuget2.config, so verify succeeds. diff --git a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/RetryRunnerTest.cs b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/RetryRunnerTest.cs index 19823f5a446..295d34f8afa 100644 --- a/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/RetryRunnerTest.cs +++ b/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/RetryRunnerTest.cs @@ -5,7 +5,6 @@ using FluentAssertions; using Microsoft.Internal.NuGet.Testing.SignedPackages.ChildProcess; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.FuncTest { @@ -31,7 +30,7 @@ public void RunWithRetries_WhenNoException_ShouldReturnResult() }; // Act - int result = RetryRunner.RunWithRetries(func, maxRetries, _output); + int result = RetryRunner.RunWithRetries(func, maxRetries, _output.WriteLine); // Assert result.Should().Be(42); @@ -55,7 +54,7 @@ public void RunWithRetries_OnException_ShouldRetry() }; // Act - int result = RetryRunner.RunWithRetries(func, maxRetries, _output); + int result = RetryRunner.RunWithRetries(func, maxRetries, _output.WriteLine); // Assert result.Should().Be(42); @@ -79,7 +78,7 @@ public void RunWithRetries_OnSuccess_ShouldNotRetry() }; // Act - int result = RetryRunner.RunWithRetries(func, maxRetries, _output); + int result = RetryRunner.RunWithRetries(func, maxRetries, _output.WriteLine); // Assert result.Should().Be(42); @@ -99,7 +98,7 @@ public void RunWithRetries_WhenMaxRetriesIsZero_ShouldNotRetry() }; // Act and Assert - Assert.Throws(() => RetryRunner.RunWithRetries(func, maxRetries, _output)); + Assert.Throws(() => RetryRunner.RunWithRetries(func, maxRetries, _output.WriteLine)); runCount.Should().Be(1); } diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/FeedPackagePruningTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/FeedPackagePruningTests.cs index aaf8368d4e5..bfbf686fd9e 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/FeedPackagePruningTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/FeedPackagePruningTests.cs @@ -14,7 +14,6 @@ using NuGet.Test.Utility; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -78,14 +77,14 @@ await SimpleTestPackageUtility.CreatePackagesAsync( var feedUrl = server.Uri + "index.json"; pathContext.Settings.AddSource(feedUrl, feedUrl, allowInsecureConnectionsValue: "true"); // Restore x 2.0.0 and populate the http cache - var r = Util.Restore(pathContext, projectA.ProjectPath, 0, _testOutputHelper, "-Source", feedUrl); + var r = Util.Restore(pathContext, projectA.ProjectPath, 0, _testOutputHelper.WriteLine, "-Source", feedUrl); // Delete x 1.0.0 File.Delete(LocalFolderUtility.GetPackageV2(serverRepoPath, packageX100.Identity, testLogger).Path); // Act // Restore x 1.0.0 - r = Util.Restore(pathContext, projectB.ProjectPath, 0, _testOutputHelper, "-Source", feedUrl); + r = Util.Restore(pathContext, projectB.ProjectPath, 0, _testOutputHelper.WriteLine, "-Source", feedUrl); var xLib = projectB.AssetsFile.Libraries.SingleOrDefault(e => e.Name == "x"); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/MSBuildProjectSystemTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/MSBuildProjectSystemTests.cs index 831bc854484..55a53fbb3f7 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/MSBuildProjectSystemTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/MSBuildProjectSystemTests.cs @@ -12,7 +12,6 @@ using NuGet.Test.Utility; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetClientCertCommandTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetClientCertCommandTests.cs index 075e42c3075..38d3154304b 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetClientCertCommandTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetClientCertCommandTests.cs @@ -14,7 +14,6 @@ using NuGet.Configuration; using NuGet.Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -52,7 +51,7 @@ public void ClientCertAddCommand_Fail_CertificateSourceCombinationSpecified() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "Invalid combination of arguments"; @@ -81,7 +80,7 @@ public void ClientCertAddCommand_Fail_CertificateSourceNotSpecified() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "Invalid combination of arguments"; @@ -112,7 +111,7 @@ public void ClientCertAddCommand_Fail_FileCertificateNotExist() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "file that does not exist"; @@ -133,7 +132,7 @@ public void ClientCertAddCommand_Fail_NoSourceSpecified() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "Property 'PackageSource' should not be null or empty"; @@ -164,7 +163,7 @@ public void ClientCertAddCommand_Fail_StoreCertificateNotExist() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "was not found"; @@ -487,7 +486,7 @@ public void ClientCertUpdateCommand_Fail_CertificateSourceCombinationSpecified() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "Invalid combination of arguments"; @@ -520,7 +519,7 @@ public void ClientCertUpdateCommand_Fail_CertificateSourceNotFound() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "does not exist"; @@ -549,7 +548,7 @@ public void ClientCertUpdateCommand_Fail_CertificateSourceNotSpecified() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "Invalid combination of arguments"; @@ -679,7 +678,7 @@ public void ClientCertUpdatedCommand_Fail_FileCertificateNotExist() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "A fileCert path specified a file that does not exist"; @@ -715,7 +714,7 @@ public void ClientCertUpdatedCommand_Fail_NotConfigured() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "does not exist"; @@ -763,7 +762,7 @@ public void ClientCertUpdatedCommand_Fail_StoreCertificateNotExist() testInfo.NuGetExePath, testInfo.WorkingPath, string.Join(" ", args.Select(a => $"\"{a}\"")), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert var expectedError = "was not found"; @@ -854,7 +853,7 @@ public void RunNuGetExpectSuccess(string[] args, string expectedOutput = null) NuGetExePath, WorkingPath, arguments, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); LogInstalledCertificates(); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetMockServerTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetMockServerTests.cs index 1bbf28f523a..8f3887d0dce 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetMockServerTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetMockServerTests.cs @@ -13,7 +13,6 @@ using NuGet.Protocol; using NuGet.Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -73,7 +72,7 @@ public void MockServer_VerifySessionId(ProjectStyle projectStyle) pathContext.Settings.AddSource("http-feed", server.Uri + "nuget", allowInsecureConnectionsValue: "true"); server.Start(); - var result = Util.Restore(pathContext, inputPath, 0, _testOutputHelper, "-Source", server.Uri + "nuget"); + var result = Util.Restore(pathContext, inputPath, 0, _testOutputHelper.WriteLine, "-Source", server.Uri + "nuget"); result.Success.Should().BeTrue(); ids.All(s => !string.IsNullOrEmpty(s) && Guid.TryParse(s, out var r)).Should().BeTrue("the values should guids"); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetPackCommandTest.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetPackCommandTest.cs index 4a933faa8f1..b17c0cc56cc 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetPackCommandTest.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetPackCommandTest.cs @@ -22,7 +22,6 @@ using NuGet.Test.Utility; using NuGet.Versioning; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -84,7 +83,7 @@ public void PackCommand_IncludeExcludePackageFromNuspec() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -163,7 +162,7 @@ public void PackCommand_AutomaticallyExcludeNuspecs() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -217,7 +216,7 @@ public void PackCommand_PackageFromNuspecWithFrameworkAssemblies() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -283,7 +282,7 @@ public void PackCommand_PackageFromNuspecWithEmptyFilesTag() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -331,7 +330,7 @@ public void PackCommand_PackageFromNuspecWithoutEmptyFilesTag() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -374,7 +373,7 @@ public void PackCommand_PackageFromNuspecWithTokenReplacement() nugetexe, workingDirectory, "pack packageA.nuspec -Properties version=2.0.0;prerelease=-preview;package=test", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -437,7 +436,7 @@ public void PackCommand_PackRuntimesRefNativeNoWarnings() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -492,7 +491,7 @@ public void PackCommand_PackAnalyzers() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -560,7 +559,7 @@ public void PackCommand_SymbolPackageWithNuspecFile() nugetexe, workingDirectory, "pack packageA.nuspec -symbols -SymbolPackageFormat snupkg", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -645,7 +644,7 @@ public void PackCommand_WhenPackingSymbolsPackage_ExcludesExplicitAssemblyRefere nugetexe, workingDirectory, "pack packageA.nuspec -symbols -SymbolPackageFormat snupkg", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.Success, r.AllOutput); // Assert @@ -728,7 +727,7 @@ public void PackCommand_SymbolPackageWithNuspecFileAndPackageType() nugetexe, workingDirectory, "pack packageA.nuspec -symbols -SymbolPackageFormat snupkg", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -807,7 +806,7 @@ public void PackCommand_ContentV2PackageFromNuspec() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -926,7 +925,7 @@ public class Class1 nugetexe, proj2Directory, "pack proj2.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1011,7 +1010,7 @@ public class Class1 nugetexe, proj1Directory, "restore packages.config -PackagesDirectory " + packagesDirectory, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(t.Success, t.AllOutput); // Act @@ -1019,7 +1018,7 @@ public class Class1 nugetexe, proj1Directory, "pack proj1.csproj -build ", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1114,7 +1113,7 @@ public class Class1 nugetexe, proj2Directory, $"pack proj2.csproj -build -IncludeReferencedProjects -symbols -SymbolPackageFormat {extension}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1188,7 +1187,7 @@ public void PackCommand_IncludesDllSymbols(SymbolPackageFormat symbolPackageForm nugetexe, projDirectory, $"pack A.csproj -build -symbols -SymbolPackageFormat {extension}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(result.ExitCode == 0, result.Output + " " + result.Errors); // Assert @@ -1260,7 +1259,7 @@ public static void Main() { } nugetexe, projDirectory, $"pack A.csproj -build -symbols -SymbolPackageFormat {extension}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(result.ExitCode == 0, result.Output + " " + result.Errors); // Assert @@ -1331,7 +1330,7 @@ public class B nugetexe, projDirectory, "pack A.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(result.ExitCode == 0, result.Output + " " + result.Errors); // Assert @@ -1428,7 +1427,7 @@ public void PackCommand_ReferencedProjectWithNuspecFile() nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1539,7 +1538,7 @@ public void PackCommand_ReferencedProjectWithNuspecFileWithMsbuild14() nugetexe, proj1Directory, $@"pack proj1.csproj -build -IncludeReferencedProjects -MSBuildVersion {version}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1644,7 +1643,7 @@ public void PackCommand_ReferencedProjectWithNuspecFileWithMsbuild15OnMono() nugetexe, proj1Directory, $@"pack proj1.csproj -build -IncludeReferencedProjects -MSBuildVersion 15.0", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1755,7 +1754,7 @@ public void PackCommand_ReferencedProjectWithCustomTokensInNuspec() nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects -Properties prefix=" + prefixTokenValue, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -1791,7 +1790,7 @@ public void PackCommand_NuspecFileWithTokensWithInvalidInformationVersion_FallsB var projectDirectory = Path.Combine(workingDirectory, "Foo"); // Act - var r = CommandRunner.Run(nugetexe, projectDirectory, "pack Foo.csproj -build", testOutputHelper: _testOutputHelper); + var r = CommandRunner.Run(nugetexe, projectDirectory, "pack Foo.csproj -build", logLine: _testOutputHelper.WriteLine); // The assembly version was used, not the informational version var outputPackageFileName = Path.Combine(projectDirectory, $"Foo.{version}.nupkg"); @@ -1819,7 +1818,7 @@ public void PackCommand_NuspecFileWithTokens_UsesInformationalVersion() var projectDirectory = Path.Combine(workingDirectory, "Foo"); // Act - var r = CommandRunner.Run(nugetexe, projectDirectory, "pack Foo.csproj -build", testOutputHelper: _testOutputHelper); + var r = CommandRunner.Run(nugetexe, projectDirectory, "pack Foo.csproj -build", logLine: _testOutputHelper.WriteLine); // The informational version without the build metadata part was used var outputPackageFileName = Path.Combine(projectDirectory, $"Foo.{semverVersion}.nupkg"); @@ -1996,7 +1995,7 @@ public void PackCommand_NuspecFileWithTokens() nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2059,7 +2058,7 @@ public void PackCommand_OutputResolvedNuSpecFileAttemptToOverwriteOriginal() Util.GetNuGetExePath(), workingDirectory, "pack packageA.nuspec -InstallPackageToOutputPath", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert @@ -2132,7 +2131,7 @@ public void PackCommand_InstallPackageToOutputPath() Util.GetNuGetExePath(), workingDirectory, arguments, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert @@ -2234,7 +2233,7 @@ public void PackCommand_InstallPackageToOutputPathWithResponseFile() Util.GetNuGetExePath(), workingDirectory, "@" + responseFilePath, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert @@ -2298,7 +2297,7 @@ public void PackCommand_OutputDirectorySuffixes(string suffix) nugetexe, proj1Directory, $"pack proj1.csproj -build -IncludeReferencedProjects -outputDirectory \"{outputDirectory}\"", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + Environment.NewLine + r.Errors); @@ -2348,7 +2347,7 @@ public void PackCommand_ProjectReferencedByMultipleProjects() nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2391,7 +2390,7 @@ public void PackCommand_ReferencedProjectWithDifferentTarget() nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2514,14 +2513,14 @@ public class Class1 msbuild, proj2Directory, "proj2.csproj /p:Config=Release", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Act r = CommandRunner.Run( nugetexe, proj2Directory, "pack proj2.csproj -p Config=Release", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2635,7 +2634,7 @@ public class Class1 nugetexe, proj2Directory, "pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2695,7 +2694,7 @@ public void PackCommand_ExcludesFilesOutsideRoot() nugetexe, projDirectory, "pack package.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); @@ -2785,7 +2784,7 @@ public class Class1 nugetexe, proj1Directory, "pack proj1.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2872,7 +2871,7 @@ public class Class1 nugetexe, proj1Directory, "pack proj1.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -2991,7 +2990,7 @@ public class Class1 nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3106,7 +3105,7 @@ public class Class1 nugetexe, proj1Directory, "pack proj1.csproj -build -IncludeReferencedProjects", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3213,14 +3212,14 @@ public class Class1 msbuild, proj1Directory, "proj1.csproj /p:Config=Release", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Act r = CommandRunner.Run( nugetexe, proj1Directory, "pack proj1.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3330,7 +3329,7 @@ public string F2(int a) nugetexe, proj2Directory, $@"pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release -msbuildversion 14", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); @@ -3455,7 +3454,7 @@ public string F2(int a) nugetexe, proj2Directory, $@"pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release -msbuildversion 15.0", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); @@ -3580,7 +3579,7 @@ public string F2(int a) nugetexe, proj2Directory, @"pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release -MSBuildVersion 15.1", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3708,7 +3707,7 @@ public string F2(int a) nugetexe, proj2Directory, $@"pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release -MSBuildPath ""{msbuildPath}"" ", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3837,7 +3836,7 @@ public string F2(int a) nugetexe, proj2Directory, $@"pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release -MSBuildPath ""{msbuildPath}"" -MSBuildVersion 12 ", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3963,7 +3962,7 @@ public string F2(int a) nugetexe, proj2Directory, $@"pack proj2.csproj -build -IncludeReferencedProjects -p Config=Release -MSBuildPath ""{msbuildPath}"" ", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -3987,7 +3986,7 @@ public void PackCommand_VersionSuffixIsAssigned() nugetexe, proj1Directory, "pack proj1.csproj -Build -Suffix alpha", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -4099,7 +4098,7 @@ public void PackCommand_PackageFromNuspecWithXmlEncoding() nugetexe, workingDirectory, "pack packageA.nuspec -verbosity detailed", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -4189,7 +4188,7 @@ public void PackCommand_MissingPackageCausesError() nugetexe, proj1Directory, "pack proj1.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.Equal(1, r.ExitCode); // Assert @@ -4235,7 +4234,7 @@ public void PackCommand_SemVer200() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -4311,7 +4310,7 @@ public class Class1 nugetexe, proj1ProjectDirectory, @"pack proj1.csproj -build -IncludeReferencedProjects -Properties Configuration=Release", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -4383,7 +4382,7 @@ public class Class1 nugetexe, proj1Directory, $"pack proj1.csproj -build -version 1.0.0-rtm+asdassd", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); r.Success.Should().BeTrue(because: r.AllOutput); var expectedMessage = "WARNING: " + NuGetLogCode.NU5115.ToString(); if (expectToWarn) @@ -4452,7 +4451,7 @@ public class Class1 nugetexe, proj1Directory, $"pack proj1.csproj -build -version 1.0.0-rtm+asdassd", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); var nupkgPath = Path.Combine(workingDirectory, "proj1", "proj1.1.0.0-rtm.nupkg"); @@ -4526,7 +4525,7 @@ public class Class1 nugetexe, proj1Directory, $"pack proj1.csproj -build -version 1.0.0-rtm+asdassd", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); var nupkgPath = Path.Combine(workingDirectory, "proj1", "proj1.1.0.0-rtm.nupkg"); @@ -4574,7 +4573,7 @@ public void PackCommand_PackLicense_SimpleExpression_StandardLicense(string lice nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -4638,7 +4637,7 @@ public void PackCommand_PackLicense_ComplexExpression_WithNonStandardLicense() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -4703,7 +4702,7 @@ public void PackCommand_PackLicense_NonParsableExpressionFailsErrorWithCode(stri nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -4751,7 +4750,7 @@ public void PackCommand_PackLicense_NonParsableVersionFailsErrorWithCode() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -4799,7 +4798,7 @@ public void PackCommand_PackLicense_ExpressionVersionHigherFailsWithErrorCode() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -4853,7 +4852,7 @@ public void PackCommand_PackLicense_PackBasicLicenseFile(string licenseFileName) nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -4921,7 +4920,7 @@ public void PackCommand_PackLicense_PackBasicLicenseFile_FileNotInPackage() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -4972,7 +4971,7 @@ public void PackCommand_PackLicense_PackBasicLicenseFile_FileExtensionNotValid() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -5024,7 +5023,7 @@ public void PackCommand_PackLicense_PackBasicLicenseFile_LicenseTypeIsNotValid() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -5073,7 +5072,7 @@ public void PackCommand_PackLicense_PackBasicLicense_LicenseValueIsEmpty(string nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // This should fail. Assert.True(1 == r.ExitCode, r.Output + " " + r.Errors); @@ -5119,7 +5118,7 @@ public void PackCommand_PackLicense_LicenseUrlIsBeingDeprecated() nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); Assert.Contains("NU5125", r.Output); @@ -5185,7 +5184,7 @@ public void PackCommand_PackLicense_BasicLicenseFileReadFileFromNupkg(string lic nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -5289,7 +5288,7 @@ public void PackCommand_PackLicense_LicenseInformationIsNotIncludedInTheSnupkg(S nugetexe, workingDirectory, $"pack {packageName}.csproj -build -symbols -SymbolPackageFormat {extension}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -5392,7 +5391,7 @@ public void PackCommand_PackageFromNuspecWithFrameworkReferences_MultiTargeting( nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -5460,7 +5459,7 @@ public void PackCommand_PackageFromNuspecWithFrameworkReferences_WithDuplicateEn nugetexe, workingDirectory, "pack packageA.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -5611,7 +5610,7 @@ public void PackCommand_PackIconUrl_Warn_Succeeds() Util.GetNuGetExePath(), testDirBuilder.BaseDir, $"pack {testDirBuilder.NuspecPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Util.VerifyResultSuccess(r, expectedOutputMessage: NuGetLogCode.NU5048.ToString()); Assert.Contains(AnalysisResources.IconUrlDeprecationWarning, r.Output); @@ -5761,7 +5760,7 @@ public void PackCommand_PackIcon_SymbolsPackage_MustNotHaveIconInfo_Succeed(Symb Util.GetNuGetExePath(), testDirBuilder.BaseDir, $"pack A.csproj -Build -Symbols -SymbolPackageFormat {symbolExtension}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Verify Util.VerifyResultSuccess(r); @@ -5830,7 +5829,7 @@ public void PackCommand_ProjectFile_PackageIconUrl_WithNuspec_WithPackTask_Warns Util.GetNuGetExePath(), testDirBuilder.BaseDir, $"pack A.csproj -Build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Util.VerifyResultSuccess(r, expectedOutputMessage: NuGetLogCode.NU5048.ToString()); Assert.Contains(AnalysisResources.IconUrlDeprecationWarning, r.Output); @@ -5872,7 +5871,7 @@ private void TestPackIconSuccess(TestDirectoryBuilder testDirBuilder, string ico Util.GetNuGetExePath(), testDirBuilder.BaseDir, $"pack {testDirBuilder.NuspecPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Util.VerifyResultSuccess(r, message); @@ -5904,7 +5903,7 @@ private void TestPackPropertyFailure(TestDirectoryBuilder testDirBuilder, string Util.GetNuGetExePath(), testDirBuilder.BaseDir, $"pack {testDirBuilder.NuspecPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Util.VerifyResultFailure(r, message); @@ -6268,7 +6267,7 @@ private void TestPackReadmeSuccess(TestDirectoryBuilder testDirBuilder, string r Util.GetNuGetExePath(), testDirBuilder.BaseDir, $"pack {testDirBuilder.NuspecPath}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Util.VerifyResultSuccess(r, message); @@ -6341,7 +6340,7 @@ public void PackCommand_Deterministic_MultiplePackInvocations_CreateIdenticalPac nugetexe, workingDirectory, string.Format(command, path), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); @@ -6421,7 +6420,7 @@ public void PackCommand_ExplicitSolutionDir() nugetexe, proj1Directory, "pack proj1.csproj -build -solutionDir ../solution", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.Success, r.AllOutput); } } @@ -6471,7 +6470,7 @@ public void PackCommand_ExplicitPackagesDir() nugetexe, proj1Directory, "pack proj1.csproj -build -packagesDir ../pkgs", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.Success, r.AllOutput); } } @@ -6597,7 +6596,7 @@ class Program {{ nugetexe, proj1Directory, $"pack proj1.csproj -build -packagesDir {packagesFolder} -solutionDir {solDirectory}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Util.VerifyResultSuccess(r); Assert.True(File.Exists(Path.Combine(proj1Directory, "proj1.0.0.0.nupkg"))); @@ -6606,7 +6605,7 @@ class Program {{ nugetexe, proj3Directory, $"pack proj3.csproj -build -packagesDir {packagesFolder2} -solutionDir {solDirectory} -configFile {Path.Combine(solDirectory, "AlternateNuget.config")}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Util.VerifyResultSuccess(r2); Assert.True(File.Exists(Path.Combine(proj3Directory, "proj3.0.0.0.nupkg"))); } @@ -6664,7 +6663,7 @@ public class Class1 nugetexe, proj1Directory, $"pack proj1.csproj -build -version 1.0.0-rtm+asdassd", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); r.Success.Should().BeTrue(because: r.AllOutput); r.AllOutput.Should().NotContain(NuGetLogCode.NU5105.ToString()); } @@ -6765,7 +6764,7 @@ public class Class1 nugetexe, projectDirectory, "pack -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -6885,7 +6884,7 @@ public class Class1 renamedNuGetExe, projectDirectory, "pack -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); // Assert @@ -6931,7 +6930,7 @@ public void PackCommand_RequireLicenseAcceptanceNotEmitted() nugetexe, projDirectory, "pack A.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(result.ExitCode == 0, result.Output + " " + result.Errors); // Assert @@ -6978,12 +6977,12 @@ public void PackCommand_NoProjectFileWithDefaultNuspec_GlobsAllFiles() nugetexe, workingDirectory, "spec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); CommandRunnerResult packResult = CommandRunner.Run( nugetexe, workingDirectory, "pack Package.nuspec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == specResult.ExitCode, specResult.AllOutput); Assert.True(0 == packResult.ExitCode, packResult.AllOutput); @@ -7058,7 +7057,7 @@ public class Class1 nugetexe, workingDirectory, "spec", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(0 == specResult.ExitCode, specResult.AllOutput); @@ -7066,7 +7065,7 @@ public class Class1 nugetexe, workingDirectory, " pack -properties tagVar=CustomTag;author=microsoft.com;Description=aaaaaaa -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(0 == packResult.ExitCode, packResult.AllOutput); @@ -7129,7 +7128,7 @@ public class Class1 Util.GetNuGetExePath(), proj1Directory, "pack proj1.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); r.Success.Should().BeFalse(); r.AllOutput.Should().Contain("NU5049"); r.AllOutput.Should().Contain("dotnet pack"); @@ -7180,7 +7179,7 @@ public class Class1 { { "NUGET_ENABLE_LEGACY_CSPROJ_PACK", "true" } }, - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); r.Success.Should().BeTrue(); r.AllOutput.Should().NotContain("NU5049"); r.AllOutput.Should().NotContain("dotnet pack"); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs index b7579e26f29..7bb24324655 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetRestoreCommandTest.cs @@ -3596,7 +3596,7 @@ public void RestoreCommand_WithMultipleProjectsInSameDirectory_RaisesAppropriate } [SkipMono()] - public async void RestoreCommand_WithPackagesConfigProject_PackageWithVulnerabilities_WithSuppressedAdvisories_SuppressesExpectedVulnerabilities() + public async Task RestoreCommand_WithPackagesConfigProject_PackageWithVulnerabilities_WithSuppressedAdvisories_SuppressesExpectedVulnerabilities() { // Arrange var nugetexe = Util.GetNuGetExePath(); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetUpdateCommandTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetUpdateCommandTests.cs index 86bf7c8d57c..7f396cb61d6 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetUpdateCommandTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetUpdateCommandTests.cs @@ -21,7 +21,6 @@ using NuGet.Versioning; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -134,7 +133,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -217,7 +216,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -340,7 +339,7 @@ await msBuildProject2.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -435,7 +434,7 @@ await msBuildProject1.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -523,7 +522,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -605,7 +604,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -687,7 +686,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -776,7 +775,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -869,7 +868,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -962,7 +961,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -1045,7 +1044,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -1128,7 +1127,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); System.Console.WriteLine(r.Output); @@ -1238,7 +1237,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); @@ -1335,7 +1334,7 @@ await msBuildProject1.InstallPackageAsync( Util.GetNuGetExePath(), solutionDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Should be no errors returned - used to fail as update command assumed folder was \packages. Assert.Empty(r.Errors); @@ -1426,7 +1425,7 @@ public void UpdateCommand_FromProjectConfig(string configFileName) nugetexe, solutionDirectory, string.Join(" ", restoreArgs), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Act var args = new[] @@ -1521,7 +1520,7 @@ await msBuildProject1.InstallPackageAsync( Util.GetNuGetExePath(), solutionDirectory, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Should be no errors returned - used to fail as update command assumed folder was \packages. Assert.Empty(r.Errors); @@ -1650,7 +1649,7 @@ await msBuildProject2.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Assert.True(r.ExitCode == 0, "Output is " + r.Output + ". Error is " + r.Errors); } @@ -1743,7 +1742,7 @@ await msBuildProject.InstallPackageAsync( Util.GetNuGetExePath(), workingPath, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); //Assert Assert.True(commandRunResult.ExitCode == 0, "Output is " + commandRunResult.Output + ". Error is " + commandRunResult.Errors); @@ -1778,7 +1777,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var nugetExe = Path.Combine(pathContext.WorkingDirectory, "NuGet.exe"); File.Copy(Util.GetNuGetExePath(), nugetExe); - Util.RunCommand(pathContext, nugetExe, 0, testOutputHelper: _testOutputHelper, "update", "-self", "-source", pathContext.PackageSource); + Util.RunCommand(pathContext, nugetExe, 0, logLine: _testOutputHelper.WriteLine, "update", "-self", "-source", pathContext.PackageSource); Assert.Equal(expectedFileContent, File.ReadAllBytes(nugetExe)); } @@ -1793,7 +1792,7 @@ public void UpdateCommand_Self_FailsWithMoreThanOneSource() var nugetExe = Path.Combine(pathContext.WorkingDirectory, "NuGet.exe"); File.Copy(Util.GetNuGetExePath(), nugetExe); - CommandRunnerResult result = Util.RunCommand(pathContext, nugetExe, 1, testOutputHelper: _testOutputHelper, "update", "-self", "-source", pathContext.PackageSource, "-source", pathContext.HttpCacheFolder); + CommandRunnerResult result = Util.RunCommand(pathContext, nugetExe, 1, logLine: _testOutputHelper.WriteLine, "update", "-self", "-source", pathContext.PackageSource, "-source", pathContext.HttpCacheFolder); result.ExitCode.Equals(1); result.AllOutput.Contains(NuGetResources.Error_UpdateSelf_Source); } diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/ProjectFactoryTest.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/ProjectFactoryTest.cs index 785847c4973..271f5d86d0b 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/ProjectFactoryTest.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/ProjectFactoryTest.cs @@ -23,7 +23,6 @@ namespace NuGet.CommandLine using global::Test.Utility; using Microsoft.Internal.NuGet.Testing.SignedPackages.ChildProcess; using NuGet.Packaging; - using Xunit.Abstractions; public class ProjectFactoryTest { @@ -487,7 +486,7 @@ public async Task EnsureProjectFactoryDoesNotAddFileThatIsAlreadyInPackage() nugetexe, workingDirectory, "pack Assembly.csproj -build", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); Util.VerifyResultSuccess(r); @@ -531,7 +530,7 @@ public async Task EnsureProjectFactoryWorksAsExpectedWithReferenceOutputAssembly nugetexe, workingDirectory, $"pack Link{Path.DirectorySeparatorChar}Link.csproj -build -IncludeReferencedProjects -Version 1.0.0", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Util.VerifyResultSuccess(r); @@ -585,7 +584,7 @@ public async Task EnsureProjectFactoryWorksAsExpectedWithReferenceOutputAssembly nugetexe, workingDirectory, $"pack Link{Path.DirectorySeparatorChar}Link.csproj -build -IncludeReferencedProjects -Version 1.0.0", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Util.VerifyResultSuccess(r); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RegistryKeyUtilityTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RegistryKeyUtilityTests.cs index f0bd9e63c03..3edc8bd71d5 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RegistryKeyUtilityTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RegistryKeyUtilityTests.cs @@ -5,7 +5,6 @@ using Microsoft.Win32; using NuGet.Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreLoggingTests.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreLoggingTests.cs index a1dd6204b05..eed2f6f3f44 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreLoggingTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreLoggingTests.cs @@ -14,7 +14,6 @@ using NuGet.Frameworks; using NuGet.Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -72,7 +71,7 @@ public async Task RestoreLogging_VerifyNU1605DowngradeWarningAsync() doc.Save(projectA.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -135,7 +134,7 @@ public async Task RestoreLogging_VerifyNU1608MessageAsync() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); var log = projectA.AssetsFile.LogMessages.SingleOrDefault(e => e.Code == NuGetLogCode.NU1608); // Assert @@ -204,11 +203,11 @@ public async Task RestoreLogging_MissingNuspecInGlobalPackages_FailsWithNU5037As solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); //delete the project.assets file to avoid no-op restore File.Delete(projectA.AssetsFileOutputPath); File.Delete(Path.Combine(pathContext.UserPackagesFolder, packageX.Id, packageX.Version, packageX.Id + NuGetConstants.ManifestExtension)); - r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -279,7 +278,7 @@ public async Task RestoreLogging_VerifyNU1107DoesNotDisplayNU1608AlsoAsync() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -317,7 +316,7 @@ public void RestoreLogging_VerifyCompatErrorNU1201Properties() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var log = projectA.AssetsFile.LogMessages.SingleOrDefault(e => e.Code == NuGetLogCode.NU1201 && e.TargetGraphs.All(g => !g.Contains("/"))); // Assert @@ -360,7 +359,7 @@ public async Task RestoreLogging_VerifyCompatErrorNU1202PropertiesAsync() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var log = projectA.AssetsFile.LogMessages.SingleOrDefault(e => e.Code == NuGetLogCode.NU1202 && e.TargetGraphs.All(g => !g.Contains("/"))); // Assert @@ -404,7 +403,7 @@ public async Task RestoreLogging_VerifyCompatErrorNU1203PropertiesAsync() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var log = projectA.AssetsFile.LogMessages.OrderBy(e => e.Message, StringComparer.Ordinal).FirstOrDefault(e => e.Code == NuGetLogCode.NU1203); // Assert @@ -447,7 +446,7 @@ public async Task RestoreLogging_VerifyCircularDependencyErrorNU1106PropertiesAs solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var log = projectA.AssetsFile.LogMessages.SingleOrDefault(e => e.Code == NuGetLogCode.NU1108 && e.TargetGraphs.All(g => !g.Contains("/"))); // Assert @@ -523,7 +522,7 @@ public async Task RestoreLogging_VerifyConflictErrorNU1107PropertiesAsync() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var log = projectA.AssetsFile.LogMessages.SingleOrDefault(e => e.Code == NuGetLogCode.NU1107 && e.TargetGraphs.All(g => !g.Contains("/"))); // Assert @@ -604,7 +603,7 @@ public async Task RestoreLogging_VerifyConflictErrorNU1107IsResolvedByTopLevelRe solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -651,7 +650,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -701,7 +700,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -756,7 +755,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -812,7 +811,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -863,7 +862,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -916,7 +915,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -967,7 +966,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -1018,7 +1017,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1069,7 +1068,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -1118,7 +1117,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1169,7 +1168,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1220,7 +1219,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1269,7 +1268,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1321,7 +1320,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1372,7 +1371,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1420,7 +1419,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1470,7 +1469,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -1525,7 +1524,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1581,7 +1580,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -1632,7 +1631,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1685,7 +1684,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1736,7 +1735,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -1787,7 +1786,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1838,7 +1837,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -1887,7 +1886,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1936,7 +1935,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -1988,7 +1987,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -2040,7 +2039,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX9); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -2073,7 +2072,7 @@ public void RestoreLogging_PackagesLockFile_InvalidInputError() File.Create(projectA.NuGetLockFileOutputPath).Close(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -2121,14 +2120,14 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( pathContext.PackageSource, packageX, packageY); - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); projectA.AddPackageToAllFrameworks(packageY); projectA.Properties.Add("RestoreLockedMode", "true"); projectA.Save(); // Act - r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreNETCoreTest.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreNETCoreTest.cs index 95342d932c5..2d3744d7f0e 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreNETCoreTest.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/RestoreNETCoreTest.cs @@ -26,7 +26,6 @@ using NuGet.Versioning; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -79,7 +78,7 @@ public async Task RestoreNetCore_AddExternalTargetVerifyTargetUsedAsync() doc.Save(projectA.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -116,7 +115,7 @@ public void RestoreNetCore_IfProjectsWitAndWithoutRestoreTargetsExistVerifyValid File.WriteAllText(projectB.ProjectPath, ""); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -149,7 +148,7 @@ public void RestoreNetCore_IfAllProjectsAreWithoutRestoreTargetsVerifySuccess() File.WriteAllText(projectA.ProjectPath, ""); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -470,14 +469,14 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); //Act - var r1 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r1 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); //Assert. Assert.Equal(0, r1.ExitCode); Assert.Contains("Writing cache file", r1.Output); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); //Assert. Assert.Equal(0, r2.ExitCode); @@ -512,7 +511,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(configPath, doc.ToString()); // Act - var r3 = Util.RestoreSolution(pathContext, 0, _testOutputHelper, "-configFile", "NuGet.Config"); + var r3 = Util.RestoreSolution(pathContext, 0, _testOutputHelper.WriteLine, "-configFile", "NuGet.Config"); //Assert. @@ -551,14 +550,14 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); //Act - var r1 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r1 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); //Assert. Assert.Equal(0, r1.ExitCode); Assert.Contains("Writing cache file", r1.Output); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); //Assert. Assert.Equal(0, r2.ExitCode); @@ -594,7 +593,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(configPath, doc.ToString()); // Act - var r3 = Util.RestoreSolution(pathContext, 0, testOutputHelper: _testOutputHelper, "-configFile", "NuGet.Config"); + var r3 = Util.RestoreSolution(pathContext, 0, logLine: _testOutputHelper.WriteLine, "-configFile", "NuGet.Config"); //Assert. @@ -633,14 +632,14 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); //Act - var r1 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r1 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); //Assert. Assert.Equal(0, r1.ExitCode); Assert.Contains("Writing cache file", r1.Output); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); //Assert. Assert.Equal(0, r2.ExitCode); @@ -673,7 +672,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(configPath, doc.ToString()); // Act - var r3 = Util.RestoreSolution(pathContext, 0, testOutputHelper: _testOutputHelper, "-configFile", "NuGet.Config"); + var r3 = Util.RestoreSolution(pathContext, 0, logLine: _testOutputHelper.WriteLine, "-configFile", "NuGet.Config"); //Assert. @@ -714,7 +713,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var propsXML = XDocument.Load(projectA.PropsOutput); var styleNode = propsXML.Root.Elements().First().Elements(XName.Get("NuGetProjectStyle", "http://schemas.microsoft.com/developer/msbuild/2003")).FirstOrDefault(); @@ -773,7 +772,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var propsXML = XDocument.Load(projectA.PropsOutput); var styleNode = propsXML.Root.Elements().First().Elements(XName.Get("NuGetProjectStyle", "http://schemas.microsoft.com/developer/msbuild/2003")).FirstOrDefault(); @@ -837,7 +836,7 @@ public void RestoreNetCore_ProjectToProject_Recursive() nugetexe, pathContext.WorkingDirectory.Path, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); @@ -900,7 +899,7 @@ public void RestoreNetCore_ProjectToProject_RecursiveIgnoresNonRestorable() nugetexe, pathContext.WorkingDirectory.Path, string.Join(" ", args), - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); // Assert Assert.True(0 == r.ExitCode, r.Output + " " + r.Errors); @@ -950,7 +949,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -1002,7 +1001,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var output = r.Output + " " + r.Errors; // Assert @@ -1047,7 +1046,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, r.ExitCode); @@ -1092,7 +1091,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var output = r.Output + " " + r.Errors; // Assert @@ -1134,7 +1133,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -1183,7 +1182,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -1232,7 +1231,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var output = r.Output + r.Errors; // Assert @@ -1274,7 +1273,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -1352,7 +1351,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var zPath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert // Version should not be used @@ -1428,7 +1427,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var zPath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert // Version should not be used @@ -1439,7 +1438,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( Assert.Equal(testCount, Directory.GetDirectories(zPath).Length); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert // Version should not be used @@ -1495,7 +1494,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageZ); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, r.ExitCode); @@ -1547,7 +1546,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r.ExitCode); Assert.True(File.Exists(project.PropsOutput), r.Output); var propsXML = XDocument.Parse(File.ReadAllText(project.PropsOutput)); @@ -1599,7 +1598,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageZ); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, r.ExitCode); @@ -1617,7 +1616,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( project2.Save(); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, r2.ExitCode); @@ -1663,7 +1662,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, r.ExitCode); @@ -1674,7 +1673,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( project.Save(); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Equal(0, r2.ExitCode); @@ -1733,7 +1732,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var zPath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(path), r.Output); @@ -1791,7 +1790,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var path = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "1.0.0", "netcoreapp1.0", "project.assets.json"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(path), r.Output); @@ -1861,20 +1860,20 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "2.0.0", "netcoreapp1.0", "z.nuget.cache"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); // This is expected, because despite the fact that both projects resolve to the same tool, the version range they request is different so they will keep overwriting each other // Basically, it is impossible for both tools to no-op. Assert.Contains($"Writing tool assets file to disk", r2.Output); - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); } } @@ -1942,13 +1941,13 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "2.0.0", "netcoreapp1.0", "z.nuget.cache"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); @@ -2030,7 +2029,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "2.5.0", "netcoreapp1.0", "z.nuget.cache"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); @@ -2046,7 +2045,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath20 = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "2.0.0", "netcoreapp1.0", "z.nuget.cache"); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); @@ -2109,19 +2108,19 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "1.0.0", "netcoreapp1.0", "z.nuget.cache"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); Assert.Contains($"The restore inputs for 'z-netcoreapp1.0-[1.0.0, )' have not changed. No further actions are required to complete the restore", r2.Output); - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); } } @@ -2181,7 +2180,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var path = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "1.0.0", "netcoreapp1.0", "project.assets.json"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(path), r.Output); @@ -2244,19 +2243,19 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "1.0.0", "netcoreapp1.0", "z.nuget.cache"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); Assert.Contains($"The restore inputs for 'z-netcoreapp1.0-[1.0.0, )' have not changed. No further actions are required to complete the restore.", r2.Output); - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); } } @@ -2303,7 +2302,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Arrange @@ -2367,13 +2366,13 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var cachePath = Path.Combine(pathContext.UserPackagesFolder, ".tools", "x", "1.0.0", "netcoreapp1.0", "x.nuget.cache"); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper, additionalArgs: "-Recursive"); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine, additionalArgs: "-Recursive"); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); // Act - var r2 = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper, additionalArgs: "-Recursive"); + var r2 = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine, additionalArgs: "-Recursive"); // Assert Assert.True(File.Exists(assetsPath)); Assert.True(File.Exists(cachePath)); @@ -2381,7 +2380,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( Assert.Contains($"The restore inputs for 'a' have not changed. No further actions are required to complete the restore.", r2.Output); Assert.Contains($"The restore inputs for 'b' have not changed. No further actions are required to complete the restore.", r2.Output); - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); } } @@ -2426,7 +2425,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var path = Path.Combine(pathContext.UserPackagesFolder, ".tools", "x", "1.0.0", "netcoreapp1.0", "project.assets.json"); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper, additionalArgs: "-Recursive"); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine, additionalArgs: "-Recursive"); // Assert Assert.True(File.Exists(path), r.Output); @@ -2474,7 +2473,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var path = Path.Combine(pathContext.UserPackagesFolder, ".tools", "x", "1.0.0", "netcoreapp1.0", "project.assets.json"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.False(File.Exists(path), r.Output); @@ -2535,7 +2534,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var path = Path.Combine(pathContext.UserPackagesFolder, ".tools", "z", "1.0.0", "netcoreapp1.0", "project.assets.json"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains("WARNING: NU1604", r.AllOutput); @@ -2612,7 +2611,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.TargetsOutput), r.Output); @@ -2688,7 +2687,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.TargetsOutput), r.Output); @@ -2738,7 +2737,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.TargetsOutput), r.Output); @@ -2789,7 +2788,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var msbuildTargetsItems = TargetsUtility.GetMSBuildPackageImports(projectA.TargetsOutput); var msbuildPropsItems = TargetsUtility.GetMSBuildPackageImports(projectA.PropsOutput); @@ -2849,7 +2848,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var msbuildTargetsItems = TargetsUtility.GetMSBuildPackageImports(projectA.TargetsOutput); var msbuildPropsItems = TargetsUtility.GetMSBuildPackageImports(projectA.PropsOutput); @@ -2895,7 +2894,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Restore one - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var msbuildTargetsItems = TargetsUtility.GetMSBuildPackageImports(projectA.TargetsOutput); var msbuildPropsItems = TargetsUtility.GetMSBuildPackageImports(projectA.PropsOutput); @@ -2907,7 +2906,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.True(File.Exists(projectA.TargetsOutput), r.Output); msbuildTargetsItems = TargetsUtility.GetMSBuildPackageImports(projectA.TargetsOutput); @@ -2964,11 +2963,11 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Restore one - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.True(File.Exists(projectA.TargetsOutput), r.Output); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r.ExitCode); Assert.True(File.Exists(projectA.TargetsOutput), r.Output); } @@ -3055,7 +3054,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targets = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.ToDictionary(e => e.Name); @@ -3105,7 +3104,7 @@ public void RestoreNetCore_ProjectToProject_NETCoreToUnknown() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetB = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.SingleOrDefault(e => e.Name == "b"); @@ -3152,7 +3151,7 @@ public void RestoreNetCore_ProjectToProject_NETCoreToUAP() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetB = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.SingleOrDefault(e => e.Name == "b"); @@ -3218,7 +3217,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var tfm = NuGetFramework.Parse("UAP10.0"); @@ -3690,7 +3689,7 @@ public async Task RestoreNetCore_VerifyPropsAndTargetsAreWrittenWhenRestoreFails // Act // Verify failure - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); var targets = TargetsUtility.GetMSBuildPackageImports(projectA.TargetsOutput); @@ -3734,7 +3733,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -3780,7 +3779,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var xTarget = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.Single(); // Assert @@ -3824,7 +3823,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var xTarget = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.Single(); // Assert @@ -3868,7 +3867,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -3898,7 +3897,7 @@ public void RestoreNetCore_SingleProject_NonNuGet() // Act && Assert // Verify this is a noop and not a failure - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); } } @@ -3929,7 +3928,7 @@ public void RestoreNetCore_NETCore_ProjectToProject_VerifyProjectInTarget() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetB = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.SingleOrDefault(e => e.Name == "b"); @@ -3977,7 +3976,7 @@ public void RestoreNetCore_NETCore_ProjectToProject_VerifyPackageIdUsed() solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetB = projectA.AssetsFile @@ -4034,7 +4033,7 @@ public void RestoreNetCore_NETCore_ProjectToProject_IgnoreMissingProjectReferenc // Act && Assert // Missing projects are ignored during restore. These issues are reported at build time. - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); } } @@ -4079,7 +4078,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetX = projectA.AssetsFile.Targets.Single(target => string.IsNullOrEmpty(target.RuntimeIdentifier)).Libraries.SingleOrDefault(e => e.Name == "x"); @@ -4141,7 +4140,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetNet = projectA.AssetsFile.Targets.Single(e => e.TargetFramework.Equals(NuGetFramework.Parse("net46")) && string.IsNullOrEmpty(e.RuntimeIdentifier)); @@ -4196,7 +4195,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var targetNet = projectA.AssetsFile.Targets.Single(e => e.TargetFramework.Equals(NuGetFramework.Parse("net46")) && string.IsNullOrEmpty(e.RuntimeIdentifier)); @@ -4261,7 +4260,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert var xLibraryInA = projectA.AssetsFile.Libraries.Single(x => x.Name == packageX.Id); @@ -4308,7 +4307,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var xLibrary = projectA.AssetsFile.Libraries.Single(); // Assert @@ -4351,7 +4350,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var xLibrary = projectA.AssetsFile.Libraries.Single(); // Assert @@ -4395,7 +4394,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); var graph = projectA.AssetsFile.GetTarget(netcoreapp2, runtimeIdentifier: null); var lib = graph.GetTargetLibrary("x"); @@ -4452,7 +4451,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert foreach (var graph in projectA.AssetsFile.Targets) @@ -4503,7 +4502,7 @@ public void RestoreNetCore_AssetTargetFallbackWithProjectReference_VerifyFallbac solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -4556,7 +4555,7 @@ public void RestoreNetCore_AssetTargetFallbackWithProjectReference_VerifyNoFallb solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -4599,7 +4598,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.AllOutput.Should().Contain("PackageTargetFallback and AssetTargetFallback cannot be used together."); @@ -4684,7 +4683,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageZ); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert projectA.AssetsFile.Libraries.Select(e => e.Name).OrderBy(e => e).Should().BeEquivalentTo(new[] { "m", "x", "y", "z" }); @@ -4746,7 +4745,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert projectA.AssetsFile.Libraries.Select(e => e.Name).OrderBy(e => e).Should().BeEquivalentTo(new[] { "x", "y" }); @@ -4808,7 +4807,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert projectA.AssetsFile.Libraries.Select(e => e.Name).OrderBy(e => e).Should().BeEquivalentTo(new[] { "x", "y" }); @@ -4873,7 +4872,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert projectA.AssetsFile.Libraries.Select(e => e.Name).OrderBy(e => e).Should().BeEquivalentTo(new[] { "x", "y" }); @@ -4922,7 +4921,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert projectA.AssetsFile.Libraries.Select(e => e.Name).OrderBy(e => e).Should().BeEquivalentTo(new[] { "x" }); @@ -4970,7 +4969,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert projectA.AssetsFile.Libraries.Select(e => e.Name).OrderBy(e => e).Should().BeEquivalentTo(new[] { "x" }); @@ -5019,7 +5018,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var unexpectedFolder = Path.Combine(Path.GetDirectoryName(projectA.ProjectPath), "invalid"); // Act - var r = Util.RestoreSolution(pathContext, 0, testOutputHelper: _testOutputHelper, "-PackagesDirectory", "pkgs"); + var r = Util.RestoreSolution(pathContext, 0, logLine: _testOutputHelper.WriteLine, "-PackagesDirectory", "pkgs"); // Assert Directory.GetDirectories(expectedFolder).Should().NotBeEmpty(); @@ -5111,7 +5110,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageZ); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Directory.Exists(new ToolPathResolver(pathContext.UserPackagesFolder).GetToolDirectoryPath(packageM.Id, NuGetVersion.Parse(packageM.Version), netcoreapp2)); @@ -5160,7 +5159,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var expectedFolder = Path.Combine(Path.GetDirectoryName(projectA.ProjectPath), "valid"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Directory.GetDirectories(expectedFolder).Should().NotBeEmpty(); @@ -5227,7 +5226,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5271,7 +5270,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5317,7 +5316,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, 0, testOutputHelper: _testOutputHelper, "-Source", relativeSourceName); + var r = Util.RestoreSolution(pathContext, 0, logLine: _testOutputHelper.WriteLine, "-Source", relativeSourceName); // Assert r.Success.Should().BeTrue(); @@ -5362,7 +5361,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5434,7 +5433,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(configPath, doc.ToString()); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r2.Success.Should().BeTrue(); @@ -5529,7 +5528,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(configPath2, doc2.ToString()); // Act - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r2.Success.Should().BeTrue(); @@ -5582,7 +5581,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var relativePathToConfig = PathUtility.GetRelativePath(pathContext.WorkingDirectory + Path.DirectorySeparatorChar, configPath); // Act - var r = Util.RestoreSolution(pathContext, 0, testOutputHelper: _testOutputHelper, $"-ConfigFile {relativePathToConfig}"); + var r = Util.RestoreSolution(pathContext, 0, logLine: _testOutputHelper.WriteLine, $"-ConfigFile {relativePathToConfig}"); // Assert Assert.True(File.Exists(projectA.AssetsFileOutputPath), r.Output); @@ -5649,14 +5648,14 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act && Assert - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r.ExitCode); Assert.Contains("Writing cache file", r.Output); // Do it again, it should no-op now. // Act && Assert - var r2 = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r2.ExitCode); Assert.DoesNotContain("Writing cache file", r2.Output); @@ -5696,7 +5695,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act && Assert - var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r.ExitCode); Assert.Contains("Writing cache file", r.Output); @@ -5706,7 +5705,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( Assert.True(File.Exists(project.CacheFileOutputPath)); File.Delete(project.CacheFileOutputPath); - r = Util.RestoreSolution(pathContext, expectedExitCode: 0, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r.ExitCode); Assert.Contains("Writing cache file", r.Output); @@ -5748,7 +5747,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5845,7 +5844,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5908,7 +5907,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5917,7 +5916,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( Assert.True(File.Exists(projectA.NuGetLockFileOutputPath)); // Second Restore - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -5952,7 +5951,7 @@ public void RestoreNetCore_PackagesLockFile_LowercaseProjectNameSolutionRestore( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -6053,7 +6052,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -6115,7 +6114,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageY); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -6482,7 +6481,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -6536,7 +6535,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -6605,7 +6604,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( xml.Save(projectA.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -6665,7 +6664,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -6730,7 +6729,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -6802,7 +6801,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( xml.Save(projectA.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert Assert.False(r.Success, r.AllOutput); @@ -6842,7 +6841,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Projects.Add(projectA); solution.Create(); - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Preconditions Assert.True(r.Success, r.AllOutput); @@ -6861,7 +6860,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.True(r.Success, r.AllOutput); Assert.True(Directory.Exists(packagePath), $"{packageX.ToString()} is not installed"); @@ -6900,7 +6899,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Projects.Add(projectA); solution.Create(); - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Preconditions Assert.True(r.Success, r.AllOutput); @@ -6916,7 +6915,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.True(r.Success, r.AllOutput); Assert.True(Directory.Exists(packagePath), $"{packageX.ToString()} is not installed"); @@ -6961,7 +6960,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -7025,7 +7024,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -7099,7 +7098,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( xml.Save(projectB.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -7190,7 +7189,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( xml.Save(projectA.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert Assert.True(r.Success, r.AllOutput); @@ -7307,7 +7306,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act & Assert - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); Assert.Contains(NuGetLogCode.NU1213.GetName(), r.AllOutput); } } @@ -7345,7 +7344,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7362,7 +7361,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectA.Save(); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7413,7 +7412,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7433,7 +7432,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectB.Save(); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7489,7 +7488,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7509,7 +7508,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.Delete(projectA.AssetsFileOutputPath); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7562,7 +7561,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7582,7 +7581,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.Delete(projectA.AssetsFileOutputPath); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7629,7 +7628,7 @@ public void RestoreNetCore_PackagesLockFile_ProjectReferenceChange_UpdatesLockFi solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7654,7 +7653,7 @@ public void RestoreNetCore_PackagesLockFile_ProjectReferenceChange_UpdatesLockFi projectA.Save(); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7716,7 +7715,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7739,7 +7738,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectA.Save(); // Act - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7793,7 +7792,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( doc.Save(projectA.ProjectPath); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7861,7 +7860,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -7908,7 +7907,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(projectA.NuGetLockFileOutputPath, ""); // Act - var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeFalse(); @@ -7961,7 +7960,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -7981,7 +7980,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.Delete(projectA.CacheFileOutputPath); // Act - result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -8032,7 +8031,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -8094,7 +8093,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var result = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + var result = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeFalse(); @@ -8148,7 +8147,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var commandRunnerResult = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var commandRunnerResult = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert commandRunnerResult.Success.Should().BeTrue(); @@ -8172,7 +8171,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectA.Save(); // Act & Assert - commandRunnerResult = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + commandRunnerResult = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); commandRunnerResult.Success.Should().BeTrue(); commandRunnerResult.AllOutput.Contains("Writing cache file"); Assert.True(File.Exists(projectA.AssetsFileOutputPath)); @@ -8193,7 +8192,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectA.Save(); // Act & Assert. The result should not be affected by the runtime json change. - commandRunnerResult = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + commandRunnerResult = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); commandRunnerResult.Success.Should().BeTrue(); Assert.Contains("No-Op restore", commandRunnerResult.AllOutput); Assert.True(File.Exists(projectA.AssetsFileOutputPath)); @@ -8238,7 +8237,7 @@ public void RestoreNetCore_PackagesLockFile_WithProjectChangeRuntimeAndLockedMod solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8295,7 +8294,7 @@ public void RestoreNetCore_PackagesLockFile_WithProjectChangeFramweorksAndLocked _testOutputHelper.WriteLine($"InputFrameworks: {string.Join(",", lockFrameworkTransformed)}"); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8377,7 +8376,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8478,7 +8477,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8556,7 +8555,7 @@ public void RestoreNetCore_PackagesLockFile_WithDependentProjectChangeOfNotCompa solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8614,7 +8613,7 @@ public void RestoreNetCore_PackagesLockFile_WithDependentProjectChangeOfCompatib solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8686,7 +8685,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.True(File.Exists(projectA.NuGetLockFileOutputPath)); @@ -8715,7 +8714,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( //Run the restore and it should still properly restore. - var r2 = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r2 = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8763,7 +8762,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -8813,7 +8812,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -8825,7 +8824,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectA.Save(); // Act - result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -8865,7 +8864,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -8942,7 +8941,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -8950,7 +8949,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( Assert.True(File.Exists(projectA.NuGetLockFileOutputPath)); // Second Restore - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Update the cpvm cpvmFile.SetPackageVersion("x", "2.0.0"); @@ -9027,7 +9026,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9102,7 +9101,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9176,7 +9175,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9249,7 +9248,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9332,7 +9331,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9344,7 +9343,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( cpvmFile.Save(); // the addition should not impact this restore - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9354,7 +9353,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( cpvmFile.Save(); // the removal should not impact this restore - r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9449,7 +9448,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.CentralPackageVersionsManagementFile = cpvmFile; solution.Create(); - var restoreResult = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var restoreResult = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.True(restoreResult.AllOutput.Contains("NU1605")); } @@ -9641,7 +9640,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9694,7 +9693,7 @@ public void RestoreNetCore_WithMultipleFrameworksWithPlatformAndAssetTargetFallb solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9739,7 +9738,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( packageX); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); Assert.Equal(0, r.ExitCode); Assert.True(File.Exists(project.PropsOutput), r.Output); var propsXML = XDocument.Parse(File.ReadAllText(project.PropsOutput)); @@ -9803,7 +9802,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -9868,7 +9867,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - CommandRunnerResult result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + CommandRunnerResult result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -9926,7 +9925,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - CommandRunnerResult result = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + CommandRunnerResult result = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeTrue(); @@ -10001,7 +10000,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - var r = Util.RestoreSolution(pathContext, testOutputHelper: _testOutputHelper); + var r = Util.RestoreSolution(pathContext, logLine: _testOutputHelper.WriteLine); // Assert r.Success.Should().BeTrue(); @@ -10083,7 +10082,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( solution.Create(); // Act - CommandRunnerResult result = Util.RestoreSolution(pathContext, expectedExitCode: 1, testOutputHelper: _testOutputHelper); + CommandRunnerResult result = Util.RestoreSolution(pathContext, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine); // Assert result.Success.Should().BeFalse(); @@ -10842,7 +10841,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( }; // Act - var r = Util.Restore(pathContext, projectA.ProjectPath, expectedExitCode: 0, testOutputHelper: _testOutputHelper, args); + var r = Util.Restore(pathContext, projectA.ProjectPath, expectedExitCode: 0, logLine: _testOutputHelper.WriteLine, args); // Assert // If we pass source then log include actual path to repository instead of repository name. @@ -10936,7 +10935,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( }; // Act - var r = Util.Restore(pathContext, projectA.ProjectPath, expectedExitCode: 1, testOutputHelper: _testOutputHelper, args); + var r = Util.Restore(pathContext, projectA.ProjectPath, expectedExitCode: 1, logLine: _testOutputHelper.WriteLine, args); // Assert Assert.Contains("Package source mapping match not found for package ID 'Contoso.MVC.ASP'.", r.Output); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/Util.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/Util.cs index fc369cf136a..508d1fa03d3 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/Util.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/Util.cs @@ -24,7 +24,6 @@ using NuGet.Versioning; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.CommandLine.Test { @@ -50,15 +49,15 @@ public static string GetResource(string name) /// /// Restore a solution. /// - public static CommandRunnerResult RestoreSolution(SimpleTestPathContext pathContext, int expectedExitCode = 0, ITestOutputHelper testOutputHelper = null, params string[] additionalArgs) + public static CommandRunnerResult RestoreSolution(SimpleTestPathContext pathContext, int expectedExitCode = 0, Action logLine = null, params string[] additionalArgs) { - return Restore(pathContext, pathContext.SolutionRoot, expectedExitCode, testOutputHelper, additionalArgs); + return Restore(pathContext, pathContext.SolutionRoot, expectedExitCode, logLine, additionalArgs); } /// /// Run nuget.exe restore {inputPath} /// - public static CommandRunnerResult Restore(SimpleTestPathContext pathContext, string inputPath, int expectedExitCode = 0, ITestOutputHelper testOutputHelper = null, params string[] additionalArgs) + public static CommandRunnerResult Restore(SimpleTestPathContext pathContext, string inputPath, int expectedExitCode = 0, Action logLine = null, params string[] additionalArgs) { var nugetExe = GetNuGetExePath(); @@ -72,10 +71,10 @@ public static CommandRunnerResult Restore(SimpleTestPathContext pathContext, str args = args.Concat(additionalArgs).ToArray(); - return RunCommand(pathContext, nugetExe, expectedExitCode, testOutputHelper, args); + return RunCommand(pathContext, nugetExe, expectedExitCode, logLine, args); } - public static CommandRunnerResult RunCommand(SimpleTestPathContext pathContext, string nugetExe, int expectedExitCode = 0, ITestOutputHelper testOutputHelper = null, params string[] arguments) + public static CommandRunnerResult RunCommand(SimpleTestPathContext pathContext, string nugetExe, int expectedExitCode = 0, Action logLine = null, params string[] arguments) { // Store the dg file for debugging var dgPath = Path.Combine(pathContext.WorkingDirectory, "out.dg"); @@ -91,7 +90,7 @@ public static CommandRunnerResult RunCommand(SimpleTestPathContext pathContext, pathContext.WorkingDirectory.Path, string.Join(" ", arguments), environmentVariables: envVars, - testOutputHelper: testOutputHelper); + logLine: logLine); // Assert Assert.True(expectedExitCode == r.ExitCode, r.Errors + "\n\n" + r.Output); diff --git a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/XunitAttribute.cs b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/XunitAttribute.cs index ae1717c519f..e7fc18d092c 100644 --- a/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/XunitAttribute.cs +++ b/test/NuGet.Clients.Tests/NuGet.CommandLine.Test/XunitAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using NuGet.Common; using Xunit; @@ -10,7 +11,10 @@ namespace NuGet.CommandLine.Test public class WindowsNTFactAttribute : FactAttribute { - public WindowsNTFactAttribute() + public WindowsNTFactAttribute( + [CallerFilePath] string? sourceFilePath = null, + [CallerLineNumber] int sourceLineNumber = 0) + : base(sourceFilePath, sourceLineNumber) { if (Environment.OSVersion.Platform != PlatformID.Win32NT) { @@ -22,7 +26,10 @@ public WindowsNTFactAttribute() public class UnixMonoFactAttribute : FactAttribute { - public UnixMonoFactAttribute() + public UnixMonoFactAttribute( + [CallerFilePath] string? sourceFilePath = null, + [CallerLineNumber] int sourceLineNumber = 0) + : base(sourceFilePath, sourceLineNumber) { if (!RuntimeEnvironmentHelper.IsMono || RuntimeEnvironmentHelper.IsWindows) { @@ -34,7 +41,10 @@ public UnixMonoFactAttribute() public class SkipMonoAttribute : FactAttribute { - public SkipMonoAttribute() + public SkipMonoAttribute( + [CallerFilePath] string? sourceFilePath = null, + [CallerLineNumber] int sourceLineNumber = 0) + : base(sourceFilePath, sourceLineNumber) { if (RuntimeEnvironmentHelper.IsMono) { @@ -46,7 +56,10 @@ public SkipMonoAttribute() public class SkipMonoTheoryAttribute : TheoryAttribute { - public SkipMonoTheoryAttribute() + public SkipMonoTheoryAttribute( + [CallerFilePath] string? sourceFilePath = null, + [CallerLineNumber] int sourceLineNumber = 0) + : base(sourceFilePath, sourceLineNumber) { if (RuntimeEnvironmentHelper.IsMono) { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/NuGet.PackageManagement.UI.Test.csproj b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/NuGet.PackageManagement.UI.Test.csproj index b29a1f67eb0..19639a1f215 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/NuGet.PackageManagement.UI.Test.csproj +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/NuGet.PackageManagement.UI.Test.csproj @@ -17,7 +17,8 @@ - + + diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/TestNuGetUILogger.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/TestNuGetUILogger.cs index 94763a21c32..9a7698a0fce 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/TestNuGetUILogger.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/TestNuGetUILogger.cs @@ -5,7 +5,7 @@ using NuGet.Common; using NuGet.PackageManagement.VisualStudio; using NuGet.ProjectManagement; -using Xunit.Abstractions; +using Xunit; namespace NuGet.PackageManagement.UI.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/ClearNuGetLocalsViewModelTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/ClearNuGetLocalsViewModelTests.cs index 4e6d8d2eef3..0352f2fb212 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/ClearNuGetLocalsViewModelTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/ClearNuGetLocalsViewModelTests.cs @@ -25,7 +25,7 @@ public void Constructor_WithNullClearNuGetLocalsCommandExecute_ThrowsArgumentNul Assert.Throws(() => new ClearNuGetLocalsViewModel(clearNuGetLocalsCommandExecute: null!)); } - [Fact] + [WpfFact] public async Task Execute_TaskCompletedSuccessfully_PropertiesUpdated() { ClearNuGetLocalsViewModel viewModel = new ClearNuGetLocalsViewModel(clearNuGetLocalsCommandExecute: ClearNuGetLocalsCommandSuccessOnExecute); @@ -34,7 +34,7 @@ public async Task Execute_TaskCompletedSuccessfully_PropertiesUpdated() viewModel.CommandCompleteText.Should().Contain("NuGet storage cleared at"); } - [Fact] + [WpfFact] public async Task Execute_TaskFailedWithError_PropertiesUpdated() { ClearNuGetLocalsViewModel viewModel = new ClearNuGetLocalsViewModel(clearNuGetLocalsCommandExecute: ClearNuGetLocalsCommandErrorOnExecute); diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/PackageItemViewModelTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/PackageItemViewModelTests.cs index 8163621e0cc..0ef3cd1bf9e 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/PackageItemViewModelTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ViewModels/PackageItemViewModelTests.cs @@ -26,7 +26,6 @@ using NuGet.VisualStudio.Telemetry; using Test.Utility.Threading; using Xunit; -using Xunit.Abstractions; namespace NuGet.PackageManagement.UI.Test.ViewModels { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfFactAttribute.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfFactAttribute.cs deleted file mode 100644 index 1a5b5c22362..00000000000 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfFactAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Xunit; -using Xunit.Sdk; - -namespace NuGet.PackageManagement.UI.Test -{ - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - [XunitTestCaseDiscoverer("NuGet.PackageManagement.UI.Test.WpfFactDiscoverer", "NuGet.PackageManagement.UI.Test")] - public sealed class WpfFactAttribute : FactAttribute - { - } -} diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfFactDiscoverer.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfFactDiscoverer.cs deleted file mode 100644 index 5988060b3fd..00000000000 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfFactDiscoverer.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace NuGet.PackageManagement.UI.Test -{ - public sealed class WpfFactDiscoverer : IXunitTestCaseDiscoverer - { - private readonly FactDiscoverer _factDiscoverer; - - public WpfFactDiscoverer(IMessageSink diagnosticMessageSink) - { - _factDiscoverer = new FactDiscoverer(diagnosticMessageSink); - } - - public IEnumerable Discover( - ITestFrameworkDiscoveryOptions discoveryOptions, - ITestMethod testMethod, - IAttributeInfo factAttribute) - { - return _factDiscoverer.Discover(discoveryOptions, testMethod, factAttribute) - .Select(testCase => new WpfTestCase(testCase)); - } - } -} diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTestCase.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTestCase.cs deleted file mode 100644 index d0396567f7c..00000000000 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTestCase.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Threading; -using Xunit; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace NuGet.PackageManagement.UI.Test -{ - [DebuggerDisplay(@"\{ class = {TestMethod.TestClass.Class.Name}, method = {TestMethod.Method.Name}, display = {DisplayName}, skip = {SkipReason} \}")] - public sealed class WpfTestCase : LongLivedMarshalByRefObject, IXunitTestCase - { - private IXunitTestCase _testCase; - - public string DisplayName => _testCase.DisplayName; - public IMethodInfo Method => _testCase.Method; - public string SkipReason => _testCase.SkipReason; - public ITestMethod TestMethod => _testCase.TestMethod; - public object[] TestMethodArguments => _testCase.TestMethodArguments; - public Dictionary> Traits => _testCase.Traits; - public string UniqueID => _testCase.UniqueID; - - public ISourceInformation SourceInformation - { - get => _testCase.SourceInformation; - set => _testCase.SourceInformation = value; - } - - public Exception InitializationException => _testCase.InitializationException; - - public int Timeout => _testCase.Timeout; - - public WpfTestCase(IXunitTestCase testCase) - { - if (testCase == null) - { - throw new ArgumentNullException(nameof(testCase)); - } - - _testCase = testCase; - } - - [Obsolete("Called by the deserializer", error: true)] - public WpfTestCase() { } - - public Task RunAsync(IMessageSink diagnosticMessageSink, - IMessageBus messageBus, - object[] constructorArguments, - ExceptionAggregator aggregator, - CancellationTokenSource cancellationTokenSource) - { - var taskCompletionSource = new TaskCompletionSource(); - var thread = new Thread(() => - { - try - { - // Set up the SynchronizationContext so that any awaits - // resume on the STA thread as they would in a GUI app. - SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); - - // Start off the test method. - var testCaseTask = _testCase.RunAsync(diagnosticMessageSink, messageBus, constructorArguments, aggregator, cancellationTokenSource); - - // Arrange to pump messages to execute any async work associated with the test. - var frame = new DispatcherFrame(); - _ = Task.Run(async delegate - { - try - { - await testCaseTask; - } - finally - { - // The test case's execution is done. Terminate the message pump. - frame.Continue = false; - } - }); - Dispatcher.PushFrame(frame); - - // Report the result back to the Task we returned earlier. - CopyTaskResultFrom(taskCompletionSource, testCaseTask); - } - catch (Exception e) - { - taskCompletionSource.SetException(e); - } - finally - { - Dispatcher.CurrentDispatcher.InvokeShutdown(); - } - }); - - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); - - return taskCompletionSource.Task; - } - - public void Deserialize(IXunitSerializationInfo info) - { - _testCase = info.GetValue("InnerTestCase"); - } - - public void Serialize(IXunitSerializationInfo info) - { - info.AddValue("InnerTestCase", _testCase); - } - - private static void CopyTaskResultFrom(TaskCompletionSource taskCompletionSource, Task template) - { - if (taskCompletionSource == null) - { - throw new ArgumentNullException(nameof(taskCompletionSource)); - } - - if (template == null) - { - throw new ArgumentNullException(nameof(template)); - } - - if (!template.IsCompleted) - { - throw new ArgumentException("Task must be completed first.", nameof(template)); - } - - if (template.IsFaulted) - { - taskCompletionSource.SetException(template.Exception); - } - else if (template.IsCanceled) - { - taskCompletionSource.SetCanceled(); - } - else - { - taskCompletionSource.SetResult(template.Result); - } - } - } -} diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTheoryAttribute.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTheoryAttribute.cs deleted file mode 100644 index 8dc601435d0..00000000000 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTheoryAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Xunit; -using Xunit.Sdk; - -namespace NuGet.PackageManagement.UI.Test -{ - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - [XunitTestCaseDiscoverer("NuGet.PackageManagement.UI.Test.WpfTheoryDiscoverer", "NuGet.PackageManagement.UI.Test")] - public sealed class WpfTheoryAttribute : TheoryAttribute - { - } -} diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTheoryDiscoverer.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTheoryDiscoverer.cs deleted file mode 100644 index 8ef9abb2a3f..00000000000 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/WpfTheoryDiscoverer.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace NuGet.PackageManagement.UI.Test -{ - public sealed class WpfTheoryDiscoverer : IXunitTestCaseDiscoverer - { - private readonly TheoryDiscoverer _theoryDiscoverer; - - public WpfTheoryDiscoverer(IMessageSink diagnosticMessageSink) - { - _theoryDiscoverer = new TheoryDiscoverer(diagnosticMessageSink); - } - - public IEnumerable Discover( - ITestFrameworkDiscoveryOptions discoveryOptions, - ITestMethod testMethod, - IAttributeInfo factAttribute) - { - return _theoryDiscoverer.Discover(discoveryOptions, testMethod, factAttribute) - .Select(testCase => new WpfTestCase(testCase)); - } - } -} diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Xamls/InfiniteScrollListTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Xamls/InfiniteScrollListTests.cs index ce5b3099e0d..67ddfab604d 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Xamls/InfiniteScrollListTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Xamls/InfiniteScrollListTests.cs @@ -18,7 +18,6 @@ using NuGet.VisualStudio; using NuGet.VisualStudio.Internal.Contracts; using Xunit; -using Xunit.Abstractions; namespace NuGet.PackageManagement.UI.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/CpsPackageReferenceProjectTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/CpsPackageReferenceProjectTests.cs index 2e0aa7c2bbf..887fb72c97e 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/CpsPackageReferenceProjectTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/CpsPackageReferenceProjectTests.cs @@ -33,7 +33,6 @@ using Test.Utility; using Test.Utility.VisualStudio; using Xunit; -using Xunit.Abstractions; using static NuGet.PackageManagement.VisualStudio.Test.ProjectFactories; namespace NuGet.PackageManagement.VisualStudio.Test diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/ConsolidatePackageFeedTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/ConsolidatePackageFeedTests.cs index 3534171c9e4..74047e8d862 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/ConsolidatePackageFeedTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/ConsolidatePackageFeedTests.cs @@ -13,7 +13,6 @@ using NuGet.Test.Utility; using NuGet.Versioning; using Xunit; -using Xunit.Abstractions; namespace NuGet.PackageManagement.VisualStudio.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/InstalledAndTransitivePackageFeedTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/InstalledAndTransitivePackageFeedTests.cs index 9811b5ce902..d3c321d354d 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/InstalledAndTransitivePackageFeedTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/InstalledAndTransitivePackageFeedTests.cs @@ -17,7 +17,6 @@ using NuGet.Versioning; using NuGet.VisualStudio.Internal.Contracts; using Xunit; -using Xunit.Abstractions; using static NuGet.Protocol.Core.Types.PackageSearchMetadataBuilder; namespace NuGet.PackageManagement.VisualStudio.Test diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/RecommenderPackageFeedTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/RecommenderPackageFeedTests.cs index cb5c8382933..d1620647723 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/RecommenderPackageFeedTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Feeds/RecommenderPackageFeedTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Moq; -using Xunit.Abstractions; using Xunit; using NuGet.Test.Utility; using NuGet.Protocol.Core.Types; diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/NuGet.PackageManagement.VisualStudio.Test.csproj b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/NuGet.PackageManagement.VisualStudio.Test.csproj index 764fa3738fd..c1a259026ce 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/NuGet.PackageManagement.VisualStudio.Test.csproj +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/NuGet.PackageManagement.VisualStudio.Test.csproj @@ -29,6 +29,6 @@ - + diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectFactories.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectFactories.cs index d63136aebc4..877d0fc9a0d 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectFactories.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectFactories.cs @@ -21,7 +21,6 @@ using NuGet.VisualStudio; using Test.Utility; using Xunit; -using Xunit.Abstractions; namespace NuGet.PackageManagement.VisualStudio.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/NuGetProjectManagerServiceTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/NuGetProjectManagerServiceTests.cs index 4b91b0f48e3..8c7f77273f7 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/NuGetProjectManagerServiceTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/NuGetProjectManagerServiceTests.cs @@ -42,7 +42,6 @@ using Test.Utility; using Test.Utility.VisualStudio; using Xunit; -using Xunit.Abstractions; using static NuGet.PackageManagement.VisualStudio.Test.ProjectFactories; using PackageReference = NuGet.Packaging.PackageReference; using Task = System.Threading.Tasks.Task; diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/PackageVulnerabilityServiceTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/PackageVulnerabilityServiceTests.cs index a7dccbb1bef..578573c9222 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/PackageVulnerabilityServiceTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Services/PackageVulnerabilityServiceTests.cs @@ -15,7 +15,6 @@ using NuGet.Versioning; using NuGet.VisualStudio.Internal.Contracts; using Xunit; -using Xunit.Abstractions; namespace NuGet.PackageManagement.VisualStudio.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/TestNuGetUILogger.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/TestNuGetUILogger.cs index 040733a6e0e..eb988a1483f 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/TestNuGetUILogger.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/TestNuGetUILogger.cs @@ -4,7 +4,7 @@ using System; using NuGet.Common; using NuGet.ProjectManagement; -using Xunit.Abstractions; +using Xunit; namespace NuGet.PackageManagement.VisualStudio.Test { diff --git a/test/NuGet.Clients.Tests/NuGet.SolutionRestoreManager.Test/NuGet.SolutionRestoreManager.Test.csproj b/test/NuGet.Clients.Tests/NuGet.SolutionRestoreManager.Test/NuGet.SolutionRestoreManager.Test.csproj index bb7ac28e4a1..cd1c63e2fcb 100644 --- a/test/NuGet.Clients.Tests/NuGet.SolutionRestoreManager.Test/NuGet.SolutionRestoreManager.Test.csproj +++ b/test/NuGet.Clients.Tests/NuGet.SolutionRestoreManager.Test/NuGet.SolutionRestoreManager.Test.csproj @@ -11,7 +11,7 @@ - + diff --git a/test/NuGet.Clients.Tests/NuGet.Tools.Test/NuGet.Tools.Test.csproj b/test/NuGet.Clients.Tests/NuGet.Tools.Test/NuGet.Tools.Test.csproj index 16b5235c28f..756428c90e0 100644 --- a/test/NuGet.Clients.Tests/NuGet.Tools.Test/NuGet.Tools.Test.csproj +++ b/test/NuGet.Clients.Tests/NuGet.Tools.Test/NuGet.Tools.Test.csproj @@ -1,4 +1,4 @@ - + $(NETFXTargetFramework) Unit tests for NuGet.Tools. @@ -10,6 +10,6 @@ - + diff --git a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/NuGet.VisualStudio.Common.Test.csproj b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/NuGet.VisualStudio.Common.Test.csproj index b1ebf5a75fc..176aa2a0755 100644 --- a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/NuGet.VisualStudio.Common.Test.csproj +++ b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/NuGet.VisualStudio.Common.Test.csproj @@ -10,7 +10,7 @@ - + diff --git a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/OutputConsoleLoggerTests.cs b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/OutputConsoleLoggerTests.cs index d1e47a82e82..605cfd756ca 100644 --- a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/OutputConsoleLoggerTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Common.Test/OutputConsoleLoggerTests.cs @@ -70,9 +70,9 @@ void IDisposable.Dispose() _outputConsoleLogger.Dispose(); } - public Task DisposeAsync() => Task.CompletedTask; + public ValueTask DisposeAsync() => default; - public async Task InitializeAsync() + public async ValueTask InitializeAsync() { await WaitForInitializationAsync(); } diff --git a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGet.VisualStudio.Implementation.Test.csproj b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGet.VisualStudio.Implementation.Test.csproj index 45e37e0b28d..11982c1d6e4 100644 --- a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGet.VisualStudio.Implementation.Test.csproj +++ b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGet.VisualStudio.Implementation.Test.csproj @@ -11,7 +11,7 @@ - + diff --git a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGetProjectServiceV1ContractTests.cs b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGetProjectServiceV1ContractTests.cs index a8923ca1a46..1b59ef5e85a 100644 --- a/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGetProjectServiceV1ContractTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.VisualStudio.Implementation.Test/NuGetProjectServiceV1ContractTests.cs @@ -7,7 +7,6 @@ using Microsoft.VisualStudio.Sdk.TestFramework; using NuGet.VisualStudio.Contracts; using Xunit; -using Xunit.Abstractions; public class NuGetProjectServiceV1ContractTests : BrokeredServiceContractTestBase { diff --git a/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetAddPackageTests.cs b/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetAddPackageTests.cs index cc70be3db0c..9282372fb3d 100644 --- a/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetAddPackageTests.cs +++ b/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetAddPackageTests.cs @@ -19,7 +19,6 @@ using NuGet.XPlat.FuncTest; using Test.Utility; using Xunit; -using Xunit.Abstractions; using Strings = NuGet.Packaging.Strings; namespace Dotnet.Integration.Test @@ -63,7 +62,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectFilePath = Path.Combine(projectDirectory, $"{projectName}.csproj"); // Act - CommandRunnerResult result = _fixture.RunDotnetExpectSuccess(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath}", testOutputHelper: _testOutputHelper); + CommandRunnerResult result = _fixture.RunDotnetExpectSuccess(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath}", logLine: _testOutputHelper.WriteLine); // Assert // Make sure source is replaced in generated dgSpec file. @@ -100,10 +99,10 @@ public async Task AddPkg_FileBasedApp() // Generate DG file. var dgFile = Path.Join(tempDir, "dg.json"); - _fixture.RunDotnetExpectSuccess(fbaDir, $"build app.cs -t:GenerateRestoreGraphFile -p:RestoreGraphOutputPath={ArgumentEscaper.EscapeAndConcatenate([dgFile])}", testOutputHelper: _testOutputHelper); + _fixture.RunDotnetExpectSuccess(fbaDir, $"build app.cs -t:GenerateRestoreGraphFile -p:RestoreGraphOutputPath={ArgumentEscaper.EscapeAndConcatenate([dgFile])}", logLine: _testOutputHelper.WriteLine); // Get project content. - var virtualProject = _fixture.GetFileBasedAppVirtualProject(appFile, _testOutputHelper); + var virtualProject = _fixture.GetFileBasedAppVirtualProject(appFile, _testOutputHelper.WriteLine); _testOutputHelper.WriteLine("before:\n" + virtualProject.Content); Assert.DoesNotContain("PackageReference", virtualProject.Content); using var builder = new TestVirtualProjectBuilder(virtualProject); @@ -173,7 +172,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectFilePath = Path.Combine(projectDirectory, $"{projectName}.csproj"); // Act - CommandRunnerResult result = _fixture.RunDotnetExpectFailure(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath}", testOutputHelper: _testOutputHelper); + CommandRunnerResult result = _fixture.RunDotnetExpectFailure(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath}", logLine: _testOutputHelper.WriteLine); } } @@ -204,7 +203,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectFilePath = Path.Combine(projectDirectory, $"{projectName}.csproj"); // Act - CommandRunnerResult result = _fixture.RunDotnetExpectSuccess(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath} -v {packageX_V1.Version}", testOutputHelper: _testOutputHelper); + CommandRunnerResult result = _fixture.RunDotnetExpectSuccess(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath} -v {packageX_V1.Version}", logLine: _testOutputHelper.WriteLine); // Assert // Make sure source is replaced in generated dgSpec file. @@ -246,7 +245,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectFilePath = Path.Combine(projectDirectory, $"{projectName}.csproj"); // Act - CommandRunnerResult result = _fixture.RunDotnetExpectFailure(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath} -v {packageX_V2.Version}", testOutputHelper: _testOutputHelper); + CommandRunnerResult result = _fixture.RunDotnetExpectFailure(projectDirectory, $"add {projectFilePath} package {packageX} -s {sourceRelativePath} -v {packageX_V2.Version}", logLine: _testOutputHelper.WriteLine); } } @@ -275,7 +274,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectFilePath = Path.Combine(projectDirectory, $"{projectName}.csproj"); // Act - CommandRunnerResult result = _fixture.RunDotnetExpectSuccess(projectDirectory, $"add {projectFilePath} package {packageY}", testOutputHelper: _testOutputHelper); + CommandRunnerResult result = _fixture.RunDotnetExpectSuccess(projectDirectory, $"add {projectFilePath} package {packageY}", logLine: _testOutputHelper.WriteLine); // Assert @@ -346,7 +345,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(projectADirectory, "NuGet.Config"), configFile); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains($"Installed {packageX} {version} from {packageSource2.FullName}", result.AllOutput); @@ -409,7 +408,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(projectADirectory, "NuGet.Config"), configFile); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains($"Installed {packageX} {version} from {packageSource2.FullName}", result.AllOutput); @@ -474,7 +473,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(projectADirectory, "NuGet.Config"), configFile); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version} -s {pathContext.PackageSource}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version} -s {pathContext.PackageSource}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains($"Installed {packageX} {version} from {pathContext.PackageSource}", result.AllOutput); @@ -538,7 +537,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(projectADirectory, "NuGet.Config"), configFile); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version} -s {packageSource2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version} -s {packageSource2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains($"Installed {packageX} {version} from {packageSource2}", result.AllOutput); @@ -606,7 +605,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(projectADirectory, "NuGet.Config"), configFile); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains($"Installed {packageX} {version} from {packageSource2.FullName}", result.AllOutput); @@ -669,7 +668,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(projectADirectory, "NuGet.Config"), configFile); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version} -s {packageSource2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version} -s {packageSource2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains($"Installed {packageX} {version} from {packageSource2}", result.AllOutput); @@ -702,7 +701,7 @@ public void AddPkg_WhenSourceIsSignedPackageWithExpiredCertificatesAndWithTimest CommandRunnerResult result = _fixture.RunDotnetExpectSuccess( projectDirectory, $"add {projectFilePath} package {package.Id} -s {packageSourceDirectory.FullName} -v {package.Version}", - testOutputHelper: _testOutputHelper); + logLine: _testOutputHelper.WriteLine); if (RuntimeEnvironmentHelper.IsWindows) { @@ -786,7 +785,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectADirectory = Path.Combine(pathContext.SolutionRoot, projectA.ProjectName); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains(@$" @@ -834,7 +833,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectADirectory = Path.Combine(pathContext.SolutionRoot, projectA.ProjectName); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version1}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version1}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains(@$" @@ -882,7 +881,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( //Act //By default the package version used will be 2.0.0 since no version CLI argument is passed in the CLI command. - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", logLine: _testOutputHelper.WriteLine); // Assert // Checking that the PackageVersion is not updated. @@ -932,7 +931,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectADirectory = Path.Combine(pathContext.SolutionRoot, projectA.ProjectName); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains(@$"", File.ReadAllText(Path.Combine(pathContext.SolutionRoot, "Directory.Packages.props"))); @@ -984,7 +983,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectADirectory = Path.Combine(pathContext.SolutionRoot, projectA.ProjectName); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version}", logLine: _testOutputHelper.WriteLine); // Assert var propsFileFromDisk = File.ReadAllText(Path.Combine(pathContext.SolutionRoot, "Directory.Packages.props")); @@ -1050,7 +1049,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains("error: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: X", result.Output); @@ -1112,7 +1111,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains("error: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: X", result.Output); @@ -1177,7 +1176,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var result = _fixture.RunDotnetExpectSuccess( projectADirectory, $"add {projectA.ProjectPath} package {packageX}", - testOutputHelper: _testOutputHelper + logLine: _testOutputHelper.WriteLine ); // Assert @@ -1244,7 +1243,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} ", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} ", logLine: _testOutputHelper.WriteLine); // Assert Assert.DoesNotContain("error: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: X", result.Output); @@ -1309,7 +1308,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains(@$" @@ -1367,7 +1366,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", logLine: _testOutputHelper.WriteLine); // Assert Assert.DoesNotContain("error: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: X", result.Output); @@ -1429,7 +1428,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.DoesNotContain(@$" @@ -1493,7 +1492,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX}", logLine: _testOutputHelper.WriteLine); // Assert Assert.DoesNotContain("error: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: X", result.Output); @@ -1558,7 +1557,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.DoesNotContain(@$" @@ -1622,7 +1621,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectSuccess(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains(@$" @@ -1684,7 +1683,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains("error: Package reference for package 'X' defined in incorrect location, PackageReference should be defined in project file.", result.Output); @@ -1745,7 +1744,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains(" PackageVersion for package 'X' defined in incorrect location, PackageVersion should be defined in Directory.Package.props.", result.Output); @@ -1806,7 +1805,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( File.WriteAllText(Path.Combine(pathContext.SolutionRoot, "projectA", "projectA.csproj"), projectContent); //Act - var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", testOutputHelper: _testOutputHelper); + var result = _fixture.RunDotnetExpectFailure(projectADirectory, $"add {projectA.ProjectPath} package {packageX} -v {version2}", logLine: _testOutputHelper.WriteLine); // Assert Assert.Contains("The package reference X specifies a VersionOverride but the ability to override a centrally defined version is currently disabled.", result.Output); diff --git a/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetIntegrationTestFixture.cs b/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetIntegrationTestFixture.cs index 4a020132e62..e9032dc2e0b 100644 --- a/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetIntegrationTestFixture.cs +++ b/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetIntegrationTestFixture.cs @@ -20,7 +20,6 @@ using NuGet.Commands; using NuGet.Common; using NuGet.Test.Utility; -using Xunit.Abstractions; namespace Dotnet.Integration.Test { @@ -90,7 +89,7 @@ private void AddPackageSource(string name, string source) /// Creates a new dotnet project of the specified type. Note that restore/build are not run when this command is invoked. /// That is because the project generation is cached. /// - internal void CreateDotnetNewProject(string solutionRoot, string projectName, string args, ITestOutputHelper testOutputHelper = null) + internal void CreateDotnetNewProject(string solutionRoot, string projectName, string args, Action logLine = null) { args = args.Trim(); @@ -115,7 +114,7 @@ internal void CreateDotnetNewProject(string solutionRoot, string projectName, st } templateDirectory.Create(); - RunDotnetExpectSuccess(templateDirectory.FullName, $"new {templateArgs}", testOutputHelper: testOutputHelper); + RunDotnetExpectSuccess(templateDirectory.FullName, $"new {templateArgs}", logLine: logLine); // Delete the obj directory because it contains assets generated by running restore at dotnet new