NET-12: Add .NET 6 testing framework for HomeController migration#17
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
NET-12: Add .NET 6 testing framework for HomeController migration#17devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
Establishes a .NET 6 testing framework under netcore/ alongside the legacy MVC5 solution: - Migrated ASP.NET Core 6 HomeController + InternalsInfo model (cross-platform, provider-injected for testability) - xUnit unit test project (Moq + FluentAssertions) achieving 100% line/branch/ method coverage on HomeController and InternalsInfo - Integration test project using WebApplicationFactory<Program> covering every HomeController endpoint over HTTP - BenchmarkDotNet performance project with per-action benchmarks - Coverlet coverage configuration (excluding Program.cs and Razor views) - Testing / test-results documentation under netcore/docs/ Meets NET-12 acceptance criteria (>90% HomeController coverage, integration tests passing, performance baseline established). Co-Authored-By: unknown <>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Establishes a .NET 6 testing framework under a new
netcore/directory, alongside the existing MVC5/.NET Framework 4.5.1 solution at the repo root. Nothing in the legacy tree is modified.Contents of
netcore/:SampleWebApp.NetCore.slntying together four new projects.src/SampleWebApp/— an ASP.NET Core 6 port ofHomeController(Index / About / Contact / Internals / CodeView) and a rewritten cross-platformInternalsInfomodel. The model now goes through a newIInternalsInfoProviderabstraction (registered as a singleton inProgram.cs) so counters can be mocked in tests.tests/SampleWebApp.UnitTests/— xUnit + Moq + FluentAssertions. 13 tests covering everyHomeControlleraction and everyInternalsInfocode path. Coverlet (msbuild + collector) reports 100% line / branch / method onHomeController.csandInternalsInfo.cs.tests/SampleWebApp.IntegrationTests/— 10 tests usingWebApplicationFactory<Program>. Hits/,/Home,/Home/Index|About|Contact|Internals|CodeViewover HTTP, asserts200 OK+text/html, plus content checks on About/Internals and a 404 case.Program.csexposes apublic partial class Program { }hook so the factory can bind.tests/SampleWebApp.PerformanceTests/— BenchmarkDotNet project withHomeControllerBenchmarks(one bench per action,IndexasBaseline) andInternalsInfoBenchmarks. Run on demand; not wired into CI.coverlet.runsettingsexcludingProgram.csand*.cshtmlfrom coverage.docs/testing.md+docs/test-results.md+netcore/README.md..gitignoreupdated to excludecoverage.*.xml,TestResults/,BenchmarkDotNet.Artifacts/.Review & Testing Checklist for Human
This PR is yellow risk — the tests all pass locally but there are a few deliberate interpretation calls that deserve a second look.
SampleWebApp/Controllers/HomeController.csis still MVC5. To have something testable I wrote a minimal .NET 6 port of the controller as part of this PR. Confirm this is acceptable, or split it out into a separate NET-1 PR and keep only the test harness here.InternalsInfo. The original uses Windows-onlyPerformanceCounter("Memory", "Available MBytes"); I replaced it withGC.GetGCMemoryInfo()(available memory derived fromTotalAvailableMemoryBytes - MemoryLoadBytes).HeapMemoryUsedKbytesalso switched fromGC.GetTotalMemory(forceFullCollection: true)tofalse. These values are no longer numerically equivalent to the MVC5 output — confirm this is an acceptable tradeoff for cross-platform.About/Contact/Internals/CodeView.cshtml files are minimal stubs so the integration tests have something to render. The real content will need to come from whoever completes NET-1.wwwroot/.dotnet new mvcpulled in bootstrap/jquery/jquery-validation assets. They're not hand-edited but they inflate the diff significantly.Suggested test plan
Also worth spot-checking
coverage.cobertura.xml:Controllers/HomeController.csandModels/InternalsInfo.csshould both be atline-rate="1".Notes
.github/workflows), so CI checks may not run on this PR.Link to Devin session: https://app.devin.ai/sessions/c28119099a4e4047a4af9236a226e3e3