Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Update NUnit & Moq for Unit Test Project #687

Merged
merged 4 commits into from
Mar 22, 2024

Conversation

johnhenley
Copy link
Collaborator

@johnhenley johnhenley commented Mar 1, 2024

Description of PR...

Update Moq and NUnit versions to latest version to work with Visual Studio 2022 17.4+

Changes made

  • Add NUnit.Analyzers to migrate NUnit3 to NUnit4 for existing tests
  • Update NUnit3TestAdapter 4.3.1 to 4.5.0
  • Update NUnit 3.13.3 to 4.1.0
  • Update NUnit3TestAdapter 4.3.1 to 4.5.0
  • Update Moq 4.18.4 to 4.20.70
  • Update Microsoft.CodeCoverage 17.4.1 to 17.9.0
  • Update Microsoft.NET.Test.Sdk 17.4.1 to 17.9.0

How did you test these updates?

Prior to update, tests would not run
image

Exceptions in output window:

NUnit Adapter 4.3.1.0: Test discovery starting
Exception System.TypeInitializationException, Exception thrown discovering tests in E:\source\repos\johnhenley\Dnn.CommunityForums\Dnn.CommunityForumsTests\bin\Debug\DotNetNuke.Modules.ActiveForumsTests.dll
Exception System.TypeInitializationException, Exception thrown discovering tests in E:\source\repos\johnhenley\Dnn.CommunityForums\Dnn.CommunityForums\bin\DotNetNuke.Modules.ActiveForums.dll
The type initializer for 'NUnit.Engine.Services.RuntimeFrameworkService' threw an exception.
The type initializer for 'NUnit.Engine.Services.RuntimeFrameworkService' threw an exception.
   at NUnit.Engine.Services.RuntimeFrameworkService.ApplyImageData(TestPackage package)
   at NUnit.Engine.Services.RuntimeFrameworkService.SelectRuntimeFramework(TestPackage package)
   at NUnit.Engine.Runners.MasterTestRunner.GetEngineRunner()
   at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
   at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.Explore(TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 97
   at NUnit.VisualStudio.TestAdapter.NUnit3TestDiscoverer.DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger messageLogger, ITestCaseDiscoverySink discoverySink) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestDiscoverer.cs:line 82
InnerException: System.ArgumentException: Unknown framework version 8.0
Parameter name: version
   at NUnit.Engine.RuntimeFramework.GetClrVersionForFramework(Version frameworkVersion)
   at NUnit.Engine.RuntimeFramework..ctor(RuntimeType runtime, Version version, String profile)
   at NUnit.Engine.RuntimeFramework.GetNetCoreRuntimesFromDirectoryNames(IEnumerable`1 dirNames)
   at NUnit.Engine.RuntimeFramework.FindDotNetCoreFrameworks()
   at NUnit.Engine.RuntimeFramework.get_AvailableFrameworks()
   at NUnit.Engine.Services.RuntimeFrameworkService..cctor()
   at NUnit.Engine.Services.RuntimeFrameworkService.ApplyImageData(TestPackage package)
   at NUnit.Engine.Services.RuntimeFrameworkService.SelectRuntimeFramework(TestPackage package)
   at NUnit.Engine.Runners.MasterTestRunner.GetEngineRunner()
   at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
   at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.Explore(TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 97
   at NUnit.VisualStudio.TestAdapter.NUnit3TestDiscoverer.DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger messageLogger, ITestCaseDiscoverySink discoverySink) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestDiscoverer.cs:line 82
NUnit Adapter 4.3.1.0: Test discovery complete
InnerException: System.ArgumentException: Unknown framework version 8.0
Parameter name: version
   at NUnit.Engine.RuntimeFramework.GetClrVersionForFramework(Version frameworkVersion)
   at NUnit.Engine.RuntimeFramework..ctor(RuntimeType runtime, Version version, String profile)
   at NUnit.Engine.RuntimeFramework.GetNetCoreRuntimesFromDirectoryNames(IEnumerable`1 dirNames)
   at NUnit.Engine.RuntimeFramework.FindDotNetCoreFrameworks()
   at NUnit.Engine.RuntimeFramework.get_AvailableFrameworks()
   at NUnit.Engine.Services.RuntimeFrameworkService..cctor()
NUnit Adapter 4.3.1.0: Test discovery complete

After updates, ran unit tests successfully.
image

PR Template Checklist

  • Fixes Bug
  • Feature solution
  • Other
  • Requires documentation updates
  • I've updated the documentation already

@johnhenley johnhenley added dependencies Pull requests that update a dependency file tasks General maintenance tasks that aren't typical development labels Mar 1, 2024
@johnhenley johnhenley added this to the 08.01.00 milestone Mar 1, 2024
@johnhenley johnhenley self-assigned this Mar 1, 2024
@johnhenley johnhenley merged commit 78f2b63 into DNNCommunity:dev Mar 22, 2024
1 check passed
@johnhenley johnhenley deleted the tasks/nunit-updates branch April 3, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file tasks General maintenance tasks that aren't typical development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant