From f328f4cb043efcea4d171547e450b1ea7e19226d Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Thu, 18 Aug 2022 17:34:38 -0700 Subject: [PATCH 1/4] Bump test project dependencies - Castle.Core, Moq, and xUnit versions were all out of date - hold xunit.runner.visualstudio version back in .NET SDK test projects - can be moved to latest version after we stop testing on netcoreapp2.1 - add missing xunit.analyzers reference to System.Web.Razor.Test project - move all test projects to .NET v4.6.2 (a supported framework) - remove `netstandard` reference in System.Net.Http.Formatting.Test; not needed w/ new TFM & updated references - further separate build of Microsoft.TestCommon project when invoked from NetCore.Test project - special case `RestorePackages` for this case - add System.Net.Http references to avoid conflicting versions e.g. src/ and test/ TFMs differ --- .nuget/packages.config | 2 +- Runtime.msbuild | 8 ++- test/Directory.Build.props | 2 +- test/Directory.Build.targets | 2 +- .../Microsoft.AspNet.Facebook.Test.csproj | 36 +++++------ .../packages.config | 24 ++++---- .../Directory.Build.props | 9 +++ .../Microsoft.TestCommon.csproj | 19 +++--- .../Microsoft.Web.Helpers.Test.csproj | 36 +++++------ .../packages.config | 20 +++---- .../Microsoft.Web.Mvc.Test.csproj | 36 +++++------ test/Microsoft.Web.Mvc.Test/packages.config | 22 +++---- .../Microsoft.Web.WebPages.OAuth.Test.csproj | 38 ++++++------ .../packages.config | 32 +++++----- ...em.Net.Http.Formatting.NetCore.Test.csproj | 17 ++++-- ...et.Http.Formatting.NetStandard.Test.csproj | 12 ++-- .../System.Net.Http.Formatting.Test.csproj | 60 +++++++++---------- .../packages.config | 35 ++++++----- .../System.Web.Cors.Test.csproj | 36 +++++------ test/System.Web.Cors.Test/packages.config | 20 +++---- .../System.Web.Helpers.Test.csproj | 36 +++++------ test/System.Web.Helpers.Test/packages.config | 20 +++---- .../System.Web.Http.Cors.Test.csproj | 36 +++++------ .../System.Web.Http.Cors.Test/packages.config | 22 +++---- .../System.Web.Http.Integration.Test.csproj | 36 +++++------ .../packages.config | 22 +++---- .../System.Web.Http.Owin.Test.csproj | 36 +++++------ .../System.Web.Http.Owin.Test/packages.config | 30 +++++----- .../System.Web.Http.SelfHost.Test.csproj | 36 +++++------ .../packages.config | 22 +++---- .../System.Web.Http.SignalR.Test.csproj | 36 +++++------ .../packages.config | 24 ++++---- .../System.Web.Http.Test.csproj | 36 +++++------ test/System.Web.Http.Test/packages.config | 22 +++---- .../System.Web.Http.Tracing.Test.csproj | 28 ++++----- .../packages.config | 18 +++--- .../System.Web.Http.WebHost.Test.csproj | 36 +++++------ .../packages.config | 22 +++---- .../System.Web.Mvc.Test.csproj | 36 +++++------ test/System.Web.Mvc.Test/packages.config | 22 +++---- .../System.Web.Razor.Test.csproj | 35 +++++------ test/System.Web.Razor.Test/packages.config | 17 +++--- ...em.Web.WebPages.Administration.Test.csproj | 36 +++++------ .../packages.config | 22 +++---- ...System.Web.WebPages.Deployment.Test.csproj | 28 ++++----- .../packages.config | 16 ++--- .../System.Web.WebPages.Razor.Test.csproj | 36 +++++------ .../packages.config | 20 +++---- .../System.Web.WebPages.Test.csproj | 36 +++++------ test/System.Web.WebPages.Test/packages.config | 20 +++---- .../WebApiHelpPage.Test.csproj | 36 +++++------ test/WebApiHelpPage.Test/packages.config | 24 ++++---- .../WebApiHelpPage.VB.Test.csproj | 36 +++++------ .../WebMatrix.Data.Test.csproj | 36 +++++------ test/WebMatrix.Data.Test/packages.config | 20 +++---- .../WebMatrix.WebData.Test.csproj | 36 +++++------ test/WebMatrix.WebData.Test/packages.config | 20 +++---- tools/WebStack.testing.targets | 2 +- 58 files changed, 773 insertions(+), 745 deletions(-) create mode 100644 test/Microsoft.TestCommon/Directory.Build.props diff --git a/.nuget/packages.config b/.nuget/packages.config index ed6c18bcb..a8fe9612a 100644 --- a/.nuget/packages.config +++ b/.nuget/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/Runtime.msbuild b/Runtime.msbuild index d53e2e46d..ac847731a 100644 --- a/Runtime.msbuild +++ b/Runtime.msbuild @@ -65,8 +65,14 @@ + + <_ToRestore Include="@(SolutionsToBuild)" /> + <_ToRestore Include="test\Microsoft.TestCommon\Microsoft.TestCommon.csproj" + AdditionalProperties="NetFX_Core=true" + Condition=" '$(BuildPortable)' == 'true' " /> + - diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 64681b2ef..23c8b064c 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -7,6 +7,6 @@ v4.5.2 + '$(MSBuildProjectName)' != 'System.Net.Http.Formatting.NetStandard.Test' ">v4.6.2 diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index b1167ac05..99772c023 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -1,6 +1,6 @@ - diff --git a/test/Microsoft.AspNet.Facebook.Test/Microsoft.AspNet.Facebook.Test.csproj b/test/Microsoft.AspNet.Facebook.Test/Microsoft.AspNet.Facebook.Test.csproj index f9003b7dd..bedf43f90 100644 --- a/test/Microsoft.AspNet.Facebook.Test/Microsoft.AspNet.Facebook.Test.csproj +++ b/test/Microsoft.AspNet.Facebook.Test/Microsoft.AspNet.Facebook.Test.csproj @@ -1,7 +1,7 @@  - - + + {C3BEF382-C7C4-454D-B017-1EAC03E9A82C} @@ -14,16 +14,16 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True ..\..\packages\Facebook.6.4.2\lib\net45\Facebook.dll - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -36,19 +36,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -129,18 +129,18 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + + obj\NetCore\ + $(DefaultItemExcludes);obj\** + + diff --git a/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj b/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj index 4def411d9..65c984aff 100644 --- a/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj +++ b/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj @@ -1,7 +1,7 @@  - net452;net462;netcoreapp2.1 + net462;netcoreapp2.1 $(Configurations);CodeAnalysis $(DefineConstants);NETFX_CORE @@ -14,15 +14,20 @@ - + + + + - - - - - + + + + + diff --git a/test/Microsoft.Web.Helpers.Test/Microsoft.Web.Helpers.Test.csproj b/test/Microsoft.Web.Helpers.Test/Microsoft.Web.Helpers.Test.csproj index ca98914c7..1fdbb5fc0 100644 --- a/test/Microsoft.Web.Helpers.Test/Microsoft.Web.Helpers.Test.csproj +++ b/test/Microsoft.Web.Helpers.Test/Microsoft.Web.Helpers.Test.csproj @@ -1,7 +1,7 @@  - - + + {2C653A66-8159-4A41-954F-A67915DFDA87} @@ -14,31 +14,31 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -93,16 +93,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/Microsoft.Web.Helpers.Test/packages.config b/test/Microsoft.Web.Helpers.Test/packages.config index b06fb5e7a..cafc6212c 100644 --- a/test/Microsoft.Web.Helpers.Test/packages.config +++ b/test/Microsoft.Web.Helpers.Test/packages.config @@ -1,13 +1,13 @@  - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.Web.Mvc.Test/Microsoft.Web.Mvc.Test.csproj b/test/Microsoft.Web.Mvc.Test/Microsoft.Web.Mvc.Test.csproj index 52fd9cf7a..23b4b28f3 100644 --- a/test/Microsoft.Web.Mvc.Test/Microsoft.Web.Mvc.Test.csproj +++ b/test/Microsoft.Web.Mvc.Test/Microsoft.Web.Mvc.Test.csproj @@ -1,7 +1,7 @@  - - + + {6C28DA70-60F1-4442-967F-591BF3962EC5} @@ -16,13 +16,13 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -37,19 +37,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -159,16 +159,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/Microsoft.Web.Mvc.Test/packages.config b/test/Microsoft.Web.Mvc.Test/packages.config index 6e4cf51b5..72e333be0 100644 --- a/test/Microsoft.Web.Mvc.Test/packages.config +++ b/test/Microsoft.Web.Mvc.Test/packages.config @@ -1,14 +1,14 @@  - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.Web.WebPages.OAuth.Test/Microsoft.Web.WebPages.OAuth.Test.csproj b/test/Microsoft.Web.WebPages.OAuth.Test/Microsoft.Web.WebPages.OAuth.Test.csproj index 3d56fbe66..5985200ea 100644 --- a/test/Microsoft.Web.WebPages.OAuth.Test/Microsoft.Web.WebPages.OAuth.Test.csproj +++ b/test/Microsoft.Web.WebPages.OAuth.Test/Microsoft.Web.WebPages.OAuth.Test.csproj @@ -1,7 +1,7 @@  - - + + {694C6EDF-EA52-438F-B745-82B025ECC0E7} @@ -14,8 +14,8 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True @@ -42,8 +42,8 @@ False ..\..\packages\DotNetOpenAuth.OpenId.RelyingParty.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OpenId.RelyingParty.dll - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -51,19 +51,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -90,19 +90,19 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - - + <_VSRunnerVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">2.4.3 + <_VSRunnerVersion Condition=" '$(TargetFramework)' != 'netcoreapp2.1' ">2.4.5 - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers diff --git a/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj b/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj index 6d6405cb6..bdcc1288d 100644 --- a/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj +++ b/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj @@ -9,16 +9,20 @@ $(DefineConstants);Testing_NetStandard2_0 true true + + + <_VSRunnerVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">2.4.3 + <_VSRunnerVersion Condition=" '$(TargetFramework)' != 'netcoreapp2.1' ">2.4.5 - - - - + + + + all runtime; build; native; contentfiles; analyzers diff --git a/test/System.Net.Http.Formatting.Test/System.Net.Http.Formatting.Test.csproj b/test/System.Net.Http.Formatting.Test/System.Net.Http.Formatting.Test.csproj index bef6e4406..ab9d953a1 100644 --- a/test/System.Net.Http.Formatting.Test/System.Net.Http.Formatting.Test.csproj +++ b/test/System.Net.Http.Formatting.Test/System.Net.Http.Formatting.Test.csproj @@ -1,7 +1,7 @@  - - + + {7AF77741-9158-4D5F-8782-8F21FADF025F} @@ -18,50 +18,46 @@ - ..\..\packages\System.Buffers.4.5.1\lib\netstandard2.0\System.Buffers.dll + ..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll False False - ..\..\packages\System.IO.Pipelines.4.7.5\lib\netstandard2.0\System.IO.Pipelines.dll + ..\..\packages\System.IO.Pipelines.4.7.5\lib\net461\System.IO.Pipelines.dll False True - ..\..\packages\System.Memory.4.5.5\lib\netstandard2.0\System.Memory.dll + ..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll False True - ..\..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + ..\..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll False True - ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll + ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll False True - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True - - False - False - ..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll True @@ -71,19 +67,19 @@ True - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -108,21 +104,21 @@ - + - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - \ No newline at end of file + diff --git a/test/System.Net.Http.Formatting.Test/packages.config b/test/System.Net.Http.Formatting.Test/packages.config index 7d7c7a6e3..baf1c70f1 100644 --- a/test/System.Net.Http.Formatting.Test/packages.config +++ b/test/System.Net.Http.Formatting.Test/packages.config @@ -1,21 +1,20 @@  - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Cors.Test/System.Web.Cors.Test.csproj b/test/System.Web.Cors.Test/System.Web.Cors.Test.csproj index 62b4ffd51..eea07163a 100644 --- a/test/System.Web.Cors.Test/System.Web.Cors.Test.csproj +++ b/test/System.Web.Cors.Test/System.Web.Cors.Test.csproj @@ -1,7 +1,7 @@  - - + + Library @@ -14,31 +14,31 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -68,16 +68,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Cors.Test/packages.config b/test/System.Web.Cors.Test/packages.config index b06fb5e7a..cafc6212c 100644 --- a/test/System.Web.Cors.Test/packages.config +++ b/test/System.Web.Cors.Test/packages.config @@ -1,13 +1,13 @@  - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Helpers.Test/System.Web.Helpers.Test.csproj b/test/System.Web.Helpers.Test/System.Web.Helpers.Test.csproj index dbb552e83..1b14044ab 100644 --- a/test/System.Web.Helpers.Test/System.Web.Helpers.Test.csproj +++ b/test/System.Web.Helpers.Test/System.Web.Helpers.Test.csproj @@ -1,7 +1,7 @@  - - + + {D3313BDF-8071-4AC8-9D98-ABF7F9E88A57} @@ -14,12 +14,12 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -31,19 +31,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -94,16 +94,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Helpers.Test/packages.config b/test/System.Web.Helpers.Test/packages.config index b06fb5e7a..cafc6212c 100644 --- a/test/System.Web.Helpers.Test/packages.config +++ b/test/System.Web.Helpers.Test/packages.config @@ -1,13 +1,13 @@  - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.Cors.Test/System.Web.Http.Cors.Test.csproj b/test/System.Web.Http.Cors.Test/System.Web.Http.Cors.Test.csproj index db4049525..b270959ce 100644 --- a/test/System.Web.Http.Cors.Test/System.Web.Http.Cors.Test.csproj +++ b/test/System.Web.Http.Cors.Test/System.Web.Http.Cors.Test.csproj @@ -1,7 +1,7 @@  - - + + {1E89A3E9-0A7F-418F-B4BE-6E38A6315373} @@ -14,12 +14,12 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -31,19 +31,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -97,16 +97,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Http.Cors.Test/packages.config b/test/System.Web.Http.Cors.Test/packages.config index 6e4cf51b5..72e333be0 100644 --- a/test/System.Web.Http.Cors.Test/packages.config +++ b/test/System.Web.Http.Cors.Test/packages.config @@ -1,14 +1,14 @@  - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.Integration.Test/System.Web.Http.Integration.Test.csproj b/test/System.Web.Http.Integration.Test/System.Web.Http.Integration.Test.csproj index 22df805eb..6edd73613 100644 --- a/test/System.Web.Http.Integration.Test/System.Web.Http.Integration.Test.csproj +++ b/test/System.Web.Http.Integration.Test/System.Web.Http.Integration.Test.csproj @@ -1,7 +1,7 @@  - - + + {3267DFC6-B34D-4011-BC0F-D3B56AF6F608} @@ -14,12 +14,12 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -39,19 +39,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -150,16 +150,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Http.Integration.Test/packages.config b/test/System.Web.Http.Integration.Test/packages.config index 6e4cf51b5..72e333be0 100644 --- a/test/System.Web.Http.Integration.Test/packages.config +++ b/test/System.Web.Http.Integration.Test/packages.config @@ -1,14 +1,14 @@  - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.Owin.Test/System.Web.Http.Owin.Test.csproj b/test/System.Web.Http.Owin.Test/System.Web.Http.Owin.Test.csproj index 6e89f0a11..7cf636838 100644 --- a/test/System.Web.Http.Owin.Test/System.Web.Http.Owin.Test.csproj +++ b/test/System.Web.Http.Owin.Test/System.Web.Http.Owin.Test.csproj @@ -1,7 +1,7 @@  - - + + {C19267DD-3984-430C-AE18-4034F85DE4E5} @@ -14,8 +14,8 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True @@ -29,8 +29,8 @@ False ..\..\packages\Microsoft.Owin.Hosting.4.2.2\lib\net45\Microsoft.Owin.Hosting.dll - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -45,19 +45,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -106,16 +106,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Http.Owin.Test/packages.config b/test/System.Web.Http.Owin.Test/packages.config index 1c3c24447..f789b6961 100644 --- a/test/System.Web.Http.Owin.Test/packages.config +++ b/test/System.Web.Http.Owin.Test/packages.config @@ -1,18 +1,18 @@  - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.SelfHost.Test/System.Web.Http.SelfHost.Test.csproj b/test/System.Web.Http.SelfHost.Test/System.Web.Http.SelfHost.Test.csproj index bf99a8ccc..c16be2756 100644 --- a/test/System.Web.Http.SelfHost.Test/System.Web.Http.SelfHost.Test.csproj +++ b/test/System.Web.Http.SelfHost.Test/System.Web.Http.SelfHost.Test.csproj @@ -1,7 +1,7 @@  - - + + {7F29EE87-6A63-43C6-B7FF-74DD06815830} @@ -14,12 +14,12 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -37,19 +37,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -101,16 +101,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Http.SelfHost.Test/packages.config b/test/System.Web.Http.SelfHost.Test/packages.config index 6e4cf51b5..72e333be0 100644 --- a/test/System.Web.Http.SelfHost.Test/packages.config +++ b/test/System.Web.Http.SelfHost.Test/packages.config @@ -1,14 +1,14 @@  - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.SignalR.Test/System.Web.Http.SignalR.Test.csproj b/test/System.Web.Http.SignalR.Test/System.Web.Http.SignalR.Test.csproj index a7a6ce203..bea9c73c3 100644 --- a/test/System.Web.Http.SignalR.Test/System.Web.Http.SignalR.Test.csproj +++ b/test/System.Web.Http.SignalR.Test/System.Web.Http.SignalR.Test.csproj @@ -1,7 +1,7 @@  - - + + {E22245AF-D5E1-46F6-B443-C886983EC50C} @@ -13,15 +13,15 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True ..\..\packages\Microsoft.AspNet.SignalR.Core.1.0.0\lib\net40\Microsoft.AspNet.SignalR.Core.dll - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -35,19 +35,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -81,16 +81,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Http.SignalR.Test/packages.config b/test/System.Web.Http.SignalR.Test/packages.config index 420ed134e..76583074d 100644 --- a/test/System.Web.Http.SignalR.Test/packages.config +++ b/test/System.Web.Http.SignalR.Test/packages.config @@ -1,15 +1,15 @@  - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.Test/System.Web.Http.Test.csproj b/test/System.Web.Http.Test/System.Web.Http.Test.csproj index 5e7fce08b..dbda0c5e4 100644 --- a/test/System.Web.Http.Test/System.Web.Http.Test.csproj +++ b/test/System.Web.Http.Test/System.Web.Http.Test.csproj @@ -1,7 +1,7 @@  - - + + {7F2C796F-43B2-4F8F-ABFF-A154EC8AAFA1} @@ -15,12 +15,12 @@ - - ..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + ..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll True - - ..\..\packages\Moq.4.7.142\lib\net45\Moq.dll + + ..\..\packages\Moq.4.18.4\lib\net462\Moq.dll True @@ -40,19 +40,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -405,16 +405,16 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + \ No newline at end of file diff --git a/test/System.Web.Http.Test/packages.config b/test/System.Web.Http.Test/packages.config index 6e4cf51b5..72e333be0 100644 --- a/test/System.Web.Http.Test/packages.config +++ b/test/System.Web.Http.Test/packages.config @@ -1,14 +1,14 @@  - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/test/System.Web.Http.Tracing.Test/System.Web.Http.Tracing.Test.csproj b/test/System.Web.Http.Tracing.Test/System.Web.Http.Tracing.Test.csproj index a2461dfe4..ee60b9358 100644 --- a/test/System.Web.Http.Tracing.Test/System.Web.Http.Tracing.Test.csproj +++ b/test/System.Web.Http.Tracing.Test/System.Web.Http.Tracing.Test.csproj @@ -1,7 +1,7 @@  - - + + {F87FD911-4A97-4057-8EAE-1CB96B9A1937} @@ -24,19 +24,19 @@ - ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll + ..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll True - - ..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll + + ..\..\packages\xunit.assert.2.4.2\lib\netstandard1.1\xunit.assert.dll True - - ..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.4.2\lib\net452\xunit.core.dll True - - ..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.4.2\lib\net452\xunit.execution.desktop.dll True @@ -69,18 +69,18 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - + - + Date: Fri, 27 Jan 2023 19:01:02 -0800 Subject: [PATCH 2/4] React to changed xUnit APIs - adjust Microsoft.TestCommon code - nit: use `Array.Empty()` in `TranscodingStreamTests` - `TranscodingStream` `internal`s can be `private` instead --- .../Internal/TranscodingStream.cs | 4 ++-- test/Microsoft.TestCommon/FactDiscoverer.cs | 1 + test/Microsoft.TestCommon/SkippedXunitTestCase.cs | 3 ++- test/Microsoft.TestCommon/TheoryDiscoverer.cs | 1 + .../Internal/TranscodingStreamTests.cs | 6 +++--- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/System.Net.Http.Formatting/Internal/TranscodingStream.cs b/src/System.Net.Http.Formatting/Internal/TranscodingStream.cs index 9f89eeee8..9d392d469 100644 --- a/src/System.Net.Http.Formatting/Internal/TranscodingStream.cs +++ b/src/System.Net.Http.Formatting/Internal/TranscodingStream.cs @@ -31,8 +31,8 @@ internal sealed class TranscodingStream : Stream private const int MinWriteRentedArraySize = 4 * 1024; private const int MaxWriteRentedArraySize = 1024 * 1024; - internal static readonly byte[] EmptyByteBuffer = new byte[0]; - internal static readonly char[] EmptyCharBuffer = new char[0]; + private static readonly byte[] EmptyByteBuffer = new byte[0]; + private static readonly char[] EmptyCharBuffer = new char[0]; private readonly Encoding _innerEncoding; private readonly Encoding _thisEncoding; diff --git a/test/Microsoft.TestCommon/FactDiscoverer.cs b/test/Microsoft.TestCommon/FactDiscoverer.cs index db913e188..4be650293 100644 --- a/test/Microsoft.TestCommon/FactDiscoverer.cs +++ b/test/Microsoft.TestCommon/FactDiscoverer.cs @@ -76,6 +76,7 @@ public override IEnumerable Discover( var testCase = new SkippedXunitTestCase( _diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), + TestMethodDisplayOptions.None, skipReason, baseCase.TestMethod, baseCase.TestMethodArguments); diff --git a/test/Microsoft.TestCommon/SkippedXunitTestCase.cs b/test/Microsoft.TestCommon/SkippedXunitTestCase.cs index e055b1e67..b5d536d3a 100644 --- a/test/Microsoft.TestCommon/SkippedXunitTestCase.cs +++ b/test/Microsoft.TestCommon/SkippedXunitTestCase.cs @@ -29,10 +29,11 @@ public class SkippedXunitTestCase : XunitTestCase public SkippedXunitTestCase( IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, + TestMethodDisplayOptions defaultMethodDisplayOptions, String skipReason, ITestMethod testMethod, object[] testMethodArguments = null) - : base(diagnosticMessageSink, defaultMethodDisplay, testMethod, testMethodArguments) + : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) { _skipReason = skipReason; } diff --git a/test/Microsoft.TestCommon/TheoryDiscoverer.cs b/test/Microsoft.TestCommon/TheoryDiscoverer.cs index 8ca4c834e..cf62536fe 100644 --- a/test/Microsoft.TestCommon/TheoryDiscoverer.cs +++ b/test/Microsoft.TestCommon/TheoryDiscoverer.cs @@ -77,6 +77,7 @@ public override IEnumerable Discover( var testCase = new SkippedXunitTestCase( _diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), + TestMethodDisplayOptions.None, skipReason, baseCase.TestMethod, baseCase.TestMethodArguments); diff --git a/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs b/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs index 8f9a43b88..7d6e0a506 100644 --- a/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs +++ b/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs @@ -170,7 +170,7 @@ public void Dispose_WithLeaveOpenFalse_DisposesInnerStream() Stream transcodingStream = new TranscodingStream(innerStream, Encoding.UTF8, Encoding.UTF8, leaveOpen: false); transcodingStream.Dispose(); transcodingStream.Dispose(); // calling it a second time should no-op - Assert.Throws(() => innerStream.Read(TranscodingStream.EmptyByteBuffer, 0, 0)); + Assert.Throws(() => innerStream.Read(Array.Empty(), 0, 0)); // Async @@ -192,7 +192,7 @@ public void Dispose_WithLeaveOpenTrue_DoesNotDisposeInnerStream() Stream transcodingStream = new TranscodingStream(innerStream, Encoding.UTF8, Encoding.UTF8, leaveOpen: true); transcodingStream.Dispose(); transcodingStream.Dispose(); // calling it a second time should no-op - innerStream.Read(TranscodingStream.EmptyByteBuffer, 0, 0); // shouldn't throw + innerStream.Read(Array.Empty(), 0, 0); // shouldn't throw // Async @@ -1095,7 +1095,7 @@ public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] public override int GetMaxCharCount(int byteCount) => byteCount; - public override byte[] GetPreamble() => TranscodingStream.EmptyByteBuffer; + public override byte[] GetPreamble() => Array.Empty(); } // A helper type that allows synchronously writing to a stream while asynchronously From f74dff0736fd90fb2b3cd9ba15cd5ba532848c7a Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:58:59 -0700 Subject: [PATCH 3/4] Resolve xUnit issues new analyzers find - address xUnit2000 warnings - pass expected values to `Assert.Equal(...)` as correct (left) argument - make generic method types explicit to avoid `error CS0121: The call is ambiguous between the following methods or properties: ...` - note: cannot remove unnecessary xUnit1013 suppression - related bug (xunit/xunit#1466) apparently not fixed in 1.0.0 analyzers package - was xunit/xunit.analyzers#82 fix (in 2017) insufficient? --- .../ApplicationParts/ApplicationPartTest.cs | 12 ++++++------ .../ApplicationParts/ResourceHandlerTest.cs | 2 +- .../Validation/ValidationHelperTest.cs | 2 +- .../WebPage/PageDataDictionaryTest.cs | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/System.Web.WebPages.Test/ApplicationParts/ApplicationPartTest.cs b/test/System.Web.WebPages.Test/ApplicationParts/ApplicationPartTest.cs index 8ff5ea3a9..fa82487bd 100644 --- a/test/System.Web.WebPages.Test/ApplicationParts/ApplicationPartTest.cs +++ b/test/System.Web.WebPages.Test/ApplicationParts/ApplicationPartTest.cs @@ -117,7 +117,7 @@ public void GetResourceVirtualPathForTopLevelItem() var virtualPath = ApplicationPart.GetResourceVirtualPath(moduleName, moduleRoot, path); // Assert - Assert.Equal(virtualPath, "~/r.ashx/" + moduleName + "/" + "foo.txt"); + Assert.Equal("~/r.ashx/" + moduleName + "/" + "foo.txt", virtualPath); } [Fact] @@ -132,7 +132,7 @@ public void GetResourceVirtualPathForTopLevelItemAndModuleRootWithTrailingSlash( var virtualPath = ApplicationPart.GetResourceVirtualPath(moduleName, moduleRoot, path); // Assert - Assert.Equal(virtualPath, "~/r.ashx/" + moduleName + "/" + "foo.txt"); + Assert.Equal("~/r.ashx/" + moduleName + "/" + "foo.txt", virtualPath); } [Fact] @@ -147,7 +147,7 @@ public void GetResourceVirtualPathForTopLevelItemAndNestedModuleRootPath() var virtualPath = ApplicationPart.GetResourceVirtualPath(moduleName, moduleRoot, path); // Assert - Assert.Equal(virtualPath, "~/r.ashx/" + moduleName + "/" + "foo.txt"); + Assert.Equal("~/r.ashx/" + moduleName + "/" + "foo.txt", virtualPath); } [Fact] @@ -162,7 +162,7 @@ public void GetResourceVirtualPathEncodesModuleName() var virtualPath = ApplicationPart.GetResourceVirtualPath(moduleName, moduleRoot, path); // Assert - Assert.Equal(virtualPath, "~/r.ashx/" + "Debugger%20Package%20v?&%" + "/" + "foo.txt"); + Assert.Equal("~/r.ashx/" + "Debugger%20Package%20v?&%" + "/" + "foo.txt", virtualPath); } [Fact] @@ -178,7 +178,7 @@ public void GetResourceVirtualPathForNestedItemPath() var virtualPath = ApplicationPart.GetResourceVirtualPath(moduleName, moduleRoot, path); // Assert - Assert.Equal(virtualPath, "~/r.ashx/" + moduleName + "/" + itemPath); + Assert.Equal("~/r.ashx/" + moduleName + "/" + itemPath, virtualPath); } [Fact] @@ -194,7 +194,7 @@ public void GetResourceVirtualPathForItemPathWithParameters() var virtualPath = ApplicationPart.GetResourceVirtualPath(moduleName, moduleRoot, path); // Assert - Assert.Equal(virtualPath, "~/r.ashx/" + moduleName + "/" + itemPath); + Assert.Equal("~/r.ashx/" + moduleName + "/" + itemPath, virtualPath); } } } diff --git a/test/System.Web.WebPages.Test/ApplicationParts/ResourceHandlerTest.cs b/test/System.Web.WebPages.Test/ApplicationParts/ResourceHandlerTest.cs index bec2fb97c..c679afb29 100644 --- a/test/System.Web.WebPages.Test/ApplicationParts/ResourceHandlerTest.cs +++ b/test/System.Web.WebPages.Test/ApplicationParts/ResourceHandlerTest.cs @@ -29,7 +29,7 @@ public void ResourceHandlerWritesContentsOfFileToStream() // Assert response.Verify(); - Assert.Equal(Encoding.Default.GetString(stream.ToArray()), _fileContent); + Assert.Equal(_fileContent, Encoding.Default.GetString(stream.ToArray())); } [Fact] diff --git a/test/System.Web.WebPages.Test/Validation/ValidationHelperTest.cs b/test/System.Web.WebPages.Test/Validation/ValidationHelperTest.cs index 6282ee4fc..a71025d17 100644 --- a/test/System.Web.WebPages.Test/Validation/ValidationHelperTest.cs +++ b/test/System.Web.WebPages.Test/Validation/ValidationHelperTest.cs @@ -19,8 +19,8 @@ public class ValidationHelperTest : IDisposable public void FormFieldKeyIsCommonToModelStateAndValidationHelper() { // Arrange + const string key = "_FORM"; RequestFieldValidatorBase.IgnoreUseUnvalidatedValues = true; - string key = "_FORM"; ValidationHelper validationHelper = GetValidationHelper(GetContext()); // Act and Assert diff --git a/test/System.Web.WebPages.Test/WebPage/PageDataDictionaryTest.cs b/test/System.Web.WebPages.Test/WebPage/PageDataDictionaryTest.cs index 776c5f2a0..8ed9b74be 100644 --- a/test/System.Web.WebPages.Test/WebPage/PageDataDictionaryTest.cs +++ b/test/System.Web.WebPages.Test/WebPage/PageDataDictionaryTest.cs @@ -54,9 +54,9 @@ public void ContainsTest() var d = new PageDataDictionary(); var item = new KeyValuePair("x", 1); d.Add(item); - Assert.Contains(item, d); + Assert.Contains>(item, d); var item2 = new KeyValuePair("y", 2); - Assert.DoesNotContain(item2, d); + Assert.DoesNotContain>(item2, d); } [Fact] @@ -106,9 +106,9 @@ public void RemoveTest1() var d = new PageDataDictionary(); var item = new KeyValuePair("x", 2); d.Add(item); - Assert.Contains(item, d); + Assert.Contains>(item, d); d.Remove(item); - Assert.DoesNotContain(item, d); + Assert.DoesNotContain>(item, d); } [Fact] From 729b554d5dc7d225bab39b7e13e61bd031a532dd Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:10:30 -0800 Subject: [PATCH 4/4] React to new Moq changes - avoid `ProtectedMock\`1.ThrowIfPublicMethod(...)` `throw`ing - use new overloads introduced in the Moq 4.11.0 release - adjust to Moq hiding the `ObjectProxy` type better - update `ControllerContext` mocking to avoid NREs - setting `HttpContext.User` on the `Object` left `get` value `null` (did nothing) - nit: use `SetupGet(...)` for another property --- .../Internal/DelegatingStreamTest.cs | 4 ++-- .../Internal/NonClosingDelegatingStreamTest.cs | 4 ++-- .../PushStreamContentTest.cs | 6 +++--- test/System.Web.Http.Owin.Test/NonOwnedStreamTests.cs | 4 ++-- .../Dispatcher/DefaultHttpControllerActivatorTest.cs | 2 +- .../Routing/DirectRouteProviderContextTests.cs | 2 +- .../System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs | 3 ++- test/System.Web.Mvc.Test/Test/ControllerTest.cs | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/test/System.Net.Http.Formatting.Test/Internal/DelegatingStreamTest.cs b/test/System.Net.Http.Formatting.Test/Internal/DelegatingStreamTest.cs index 70d419804..8f24a05d3 100644 --- a/test/System.Net.Http.Formatting.Test/Internal/DelegatingStreamTest.cs +++ b/test/System.Net.Http.Formatting.Test/Internal/DelegatingStreamTest.cs @@ -141,7 +141,7 @@ public void DelegatingStream_Dispose() mockStream.Dispose(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Once(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Once(), exactParameterMatch: true, args: true); mockInnerStream.Verify(s => s.Close(), Times.Once()); } @@ -156,7 +156,7 @@ public void DelegatingStream_Close() mockStream.Close(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Once(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Once(), exactParameterMatch: true, args: true); mockInnerStream.Verify(s => s.Close(), Times.Once()); } diff --git a/test/System.Net.Http.Formatting.Test/Internal/NonClosingDelegatingStreamTest.cs b/test/System.Net.Http.Formatting.Test/Internal/NonClosingDelegatingStreamTest.cs index fa73637b9..838dc8634 100644 --- a/test/System.Net.Http.Formatting.Test/Internal/NonClosingDelegatingStreamTest.cs +++ b/test/System.Net.Http.Formatting.Test/Internal/NonClosingDelegatingStreamTest.cs @@ -22,7 +22,7 @@ public void NonClosingDelegatingStream_Dispose() mockStream.Dispose(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Never(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Never(), exactParameterMatch: true, args: true); mockInnerStream.Verify(s => s.Close(), Times.Never()); } @@ -37,7 +37,7 @@ public void NonClosingDelegatingStream_Close() mockStream.Close(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Never(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Never(), exactParameterMatch: true, args: true); mockInnerStream.Verify(s => s.Close(), Times.Never()); } } diff --git a/test/System.Net.Http.Formatting.Test/PushStreamContentTest.cs b/test/System.Net.Http.Formatting.Test/PushStreamContentTest.cs index 3edd521b2..a3414019d 100644 --- a/test/System.Net.Http.Formatting.Test/PushStreamContentTest.cs +++ b/test/System.Net.Http.Formatting.Test/PushStreamContentTest.cs @@ -92,7 +92,7 @@ public async Task CompleteTaskOnCloseStream_Dispose_CompletesTaskButDoNotDispose mockStream.Dispose(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Never(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Never(), exactParameterMatch: true, args: true); Assert.Equal(TaskStatus.RanToCompletion, serializeToStreamTask.Task.Status); Assert.True(await serializeToStreamTask.Task); } @@ -109,7 +109,7 @@ public async Task CompleteTaskOnCloseStream_Dispose_CompletesTaskButDoNotCloseIn mockStream.Dispose(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Never(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Never(), exactParameterMatch: true, args: true); mockInnerStream.Verify(s => s.Close(), Times.Never()); Assert.Equal(TaskStatus.RanToCompletion, serializeToStreamTask.Task.Status); Assert.True(await serializeToStreamTask.Task); @@ -127,7 +127,7 @@ public async Task NonClosingDelegatingStream_Close_CompletesTaskButDoNotCloseInn mockStream.Close(); // Assert - mockInnerStream.Protected().Verify("Dispose", Times.Never(), true); + mockInnerStream.Protected().Verify("Dispose", Times.Never(), exactParameterMatch: true, args: true); mockInnerStream.Verify(s => s.Close(), Times.Never()); Assert.Equal(TaskStatus.RanToCompletion, serializeToStreamTask.Task.Status); Assert.True(await serializeToStreamTask.Task); diff --git a/test/System.Web.Http.Owin.Test/NonOwnedStreamTests.cs b/test/System.Web.Http.Owin.Test/NonOwnedStreamTests.cs index 4591e067a..c21948fb5 100644 --- a/test/System.Web.Http.Owin.Test/NonOwnedStreamTests.cs +++ b/test/System.Web.Http.Owin.Test/NonOwnedStreamTests.cs @@ -121,7 +121,7 @@ public void Dispose_DoesNotDisposeInnerStream() Mock mock = new Mock(MockBehavior.Strict); mock.Setup(s => s.Close()).Callback(() => innerStreamDisposed = true); mock.As().Setup(s => s.Dispose()); - mock.Protected().Setup("Dispose", true).Callback(() => innerStreamDisposed = true); + mock.Protected().Setup("Dispose", exactParameterMatch: true, args: true).Callback(() => innerStreamDisposed = true); using (Stream innerStream = mock.Object) using (Stream product = CreateProductUnderTest(innerStream)) @@ -159,7 +159,7 @@ public void Close_DoesNotDisposeInnerStream() Mock mock = new Mock(MockBehavior.Strict); mock.Setup(s => s.Close()).Callback(() => innerStreamDisposed = true); mock.As().Setup(s => s.Dispose()); - mock.Protected().Setup("Dispose", true).Callback(() => innerStreamDisposed = true); + mock.Protected().Setup("Dispose", exactParameterMatch: true, args: true).Callback(() => innerStreamDisposed = true); using (Stream innerStream = mock.Object) using (Stream product = CreateProductUnderTest(innerStream)) diff --git a/test/System.Web.Http.Test/Dispatcher/DefaultHttpControllerActivatorTest.cs b/test/System.Web.Http.Test/Dispatcher/DefaultHttpControllerActivatorTest.cs index 7db1b5780..191397e83 100644 --- a/test/System.Web.Http.Test/Dispatcher/DefaultHttpControllerActivatorTest.cs +++ b/test/System.Web.Http.Test/Dispatcher/DefaultHttpControllerActivatorTest.cs @@ -153,7 +153,7 @@ public void Create_ThrowsForNullDependencyScope() exception.Message); Assert.NotNull(exception.InnerException); Assert.Matches( - "A dependency resolver of type 'ObjectProxy(_\\d+)?' returned an invalid value of null from its " + + "A dependency resolver of type 'IDependencyResolverProxy' returned an invalid value of null from its " + "BeginScope method. If the container does not have a concept of scope, consider returning a scope " + "that resolves in the root of the container instead.", exception.InnerException.Message); diff --git a/test/System.Web.Http.Test/Routing/DirectRouteProviderContextTests.cs b/test/System.Web.Http.Test/Routing/DirectRouteProviderContextTests.cs index bec090eba..891f2ba2a 100644 --- a/test/System.Web.Http.Test/Routing/DirectRouteProviderContextTests.cs +++ b/test/System.Web.Http.Test/Routing/DirectRouteProviderContextTests.cs @@ -43,7 +43,7 @@ public void CreateBuilderWithResolverAndBuild_Throws_WhenConstraintResolverRetur var ex = Assert.Throws( () => BuildWithResolver(@"hello/{param:constraint}", constraintResolver: constraintResolver.Object)); Assert.Matches( - "The inline constraint resolver of type 'ObjectProxy(_\\d+)?' was unable to resolve the following inline constraint: 'constraint'.", + "The inline constraint resolver of type 'IInlineConstraintResolverProxy' was unable to resolve the following inline constraint: 'constraint'.", ex.Message); } diff --git a/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs b/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs index f03f0c4a4..75bef6e5f 100644 --- a/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs +++ b/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs @@ -2466,6 +2466,8 @@ private static ControllerContext GetControllerContext(ControllerBase controller, Mock mockControllerContext = new Mock(); mockControllerContext.SetupGet(c => c.RouteData).Returns(new RouteData()); + mockControllerContext.SetupGet(c => c.HttpContext.Session).Returns((HttpSessionStateBase)null); + mockControllerContext.SetupProperty(c => c.HttpContext.User); mockControllerContext.Setup(c => c.HttpContext.Request.ValidateInput()).Callback(() => { @@ -2480,7 +2482,6 @@ private static ControllerContext GetControllerContext(ControllerBase controller, } }); - mockControllerContext.Setup(c => c.HttpContext.Session).Returns((HttpSessionStateBase)null); mockControllerContext.Setup(c => c.Controller).Returns(controller); return mockControllerContext.Object; } diff --git a/test/System.Web.Mvc.Test/Test/ControllerTest.cs b/test/System.Web.Mvc.Test/Test/ControllerTest.cs index b9793aaa9..f9cf70837 100644 --- a/test/System.Web.Mvc.Test/Test/ControllerTest.cs +++ b/test/System.Web.Mvc.Test/Test/ControllerTest.cs @@ -301,7 +301,7 @@ public void DisposeCallsProtectedDisposingMethod() { // Arrange Mock mockController = new Mock(); - mockController.Protected().Setup("Dispose", true).Verifiable(); + mockController.Protected().Setup("Dispose", exactParameterMatch: true, args: true).Verifiable(); Controller controller = mockController.Object; // Act