Add unit test infrastructure with xUnit, Moq, and coverlet#89
Merged
Conversation
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add unit tests implementation using Xunit and Moq
Add unit test infrastructure with xUnit, Moq, and coverlet
Feb 7, 2026
There was a problem hiding this comment.
Pull request overview
Adds a dedicated unit test project to the Portal Web solution to establish a baseline regression safety net for extension methods and the ProxyCheckService, helping catch runtime breaks introduced by dependency updates.
Changes:
- Added
XtremeIdiots.Portal.Web.Testsproject (net9.0) with xUnit, Moq, and coverlet collector, and referenced it from the web project. - Introduced initial unit test suites for claims principal extensions, IP address formatting extensions, and
ProxyCheckService. - Added a README describing test structure and how to run tests/coverage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/XtremeIdiots.Portal.Web.sln | Adds the new test project to the solution and updates solution configurations. |
| src/XtremeIdiots.Portal.Web.Tests/XtremeIdiots.Portal.Web.Tests.csproj | Introduces the test project configuration and test-related NuGet dependencies. |
| src/XtremeIdiots.Portal.Web.Tests/Extensions/ClaimsPrincipalExtensionsTests.cs | Adds unit tests for claims extraction and game/server claim filtering. |
| src/XtremeIdiots.Portal.Web.Tests/Extensions/IPAddressExtensionsTests.cs | Adds unit tests for HTML/IP formatting, badges, and link behavior. |
| src/XtremeIdiots.Portal.Web.Tests/Services/ProxyCheckServiceTests.cs | Adds unit tests for ProxyCheckService behavior including caching and error paths. |
| src/XtremeIdiots.Portal.Web.Tests/README.md | Documents how to run tests and the intended test structure/coverage areas. |
Owner
|
@copilot apply changes based on the comments in this thread |
…s, simplify solution configs Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Owner
|
@copilot apply changes based on the comments in this thread |
…ally Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
…ects Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
|
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.



Add Unit Test Infrastructure to XtremeIdiots.Portal.Web
Implementation Plan
Summary
Successfully added unit test infrastructure to the XtremeIdiots.Portal.Web project with 40 passing tests across 3 test classes.
Changes Made (Latest Commit)
PR Review Feedback Addressed (Round 3):
FAE04EC0-301F-11D3-BF4B-00C04F79EFBC) to SDK-style GUID (9A19103F-16F7-4668-BE54-9A1E7A4F7556) for consistency with other projects and to avoid potential IDE/tooling quirksPrevious Changes (Round 2):
GetIpRiskDataAsync_WithHttpError_ReturnsErrorResulttest to useusing varstatements instead of try-finally block for cleaner resource managementPrevious Changes (Round 1):
PrivateAssets="all"to coverlet.collector and xunit.runner.visualstudio packagesTests Created
ClaimsPrincipalExtensionsTests (13 tests)
IPAddressExtensionsTests (17 tests)
ProxyCheckServiceTests (10 tests)
Test Configuration
Test Results
All tests pass successfully:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.