Conversation
Co-authored-by: rowantervelde <22254598+rowantervelde@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [xunit-expert] Improve test quality for UnitTests.cs
Refactor UnitTests.cs: remove placeholder, split parser tests, add ParseDirectory coverage, extract fixture
Mar 14, 2026
This was referenced Mar 14, 2026
This was referenced Mar 21, 2026
This was referenced Mar 28, 2026
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.
UnitTests.cscontained aTruth_IsTrue()placeholder, a monolithic parser test doing too much, duplicated solution-root discovery boilerplate, and zero coverage forVektisCsvParser.ParseDirectory.Changes
Truth_IsTrue()false-green placeholderIntegrationTestFixture : IClassFixture<T>, exposingSolutionRoot,VektisDataPath, andPostcode3DataPath; shared across both test classesParser_CanParseRealVektisFileinto two focused tests inside a newVektisCsvParserTestsclass:ParseFile_CsvHeaders_HasExpectedStructure— asserts column count and fixed column namesParseFile_DataRows_AreProperlyParsed— asserts decimal parsing +ParseFileoutput recordsParseDirectorycoverage:ParseDirectory_ReturnsRecordsFromMultipleFiles— verifies records span ≥2 yearsParseDirectory_EmptyDirectory_ReturnsEmptyList— edge case with a temp dir[Theory]/[InlineData]testService_LoadedData_ContainsExpectedYearfor years 2011 and 2023 inVektisDataServiceIntegrationTestsOriginal prompt
This section details on the original issue you should resolve
<issue_title>[xunit-expert] Improve Test Quality: CareMetrics.Tests/UnitTests.cs</issue_title>
<issue_description>The test file
CareMetrics.Tests/UnitTests.cshas been selected for quality improvement by the xUnit Test Quality Expert. This issue provides specific, actionable recommendations to enhance test quality, coverage, and maintainability using xUnit best practices for .NET 10.Current State
CareMetrics.Tests/UnitTests.csCareMetrics.API/Services/VektisCsvParser.cs,CareMetrics.API/Services/VektisDataService.cs[Fact]/ 0[Theory]methodsTest Quality Analysis
Strengths ✅
Parser_CanParseRealVektisFileandService_CanLoadSampleCsv_FromConfigurationexercise the actual CSV files on disk, catching real parsing regressions.$"Expected >{count} records, got {actual}"and hex-encoded byte output aids debugging when tests fail in CI.Areas for Improvement 🎯
1. Remove Placeholder Test (HIGH PRIORITY)
Current Issue:
UnitTests.cscontains a placeholder test that always passes and asserts nothing:This is the classic xUnit anti-pattern. It inflates the test count, provides zero coverage signal, and can mask missing tests when developers see "all tests pass."
Recommended Change:
Delete this test entirely, or replace it with a meaningful test (e.g. testing
VektisCsvParserwith a known-good string or testing a boundary condition).Why this matters: Placeholder tests erode trust in the test suite. When every test passes but one of them is
Assert.True(true), the green badge means less.2. Extract Duplicated Solution-Root Discovery (MEDIUM PRIORITY)
Current Issue:
Both
Parser_CanParseRealVektisFileandService_CanLoadSampleCsv_FromConfigurationrepeat the same 5-line boilerplate to walk up the directory tree:Recommended Change:
Extract to a shared helper in the test class, or introduce an
IClassFixture(T)that resolves the solution root once:Why this matters: Follows the DRY principle, and
IClassFixture(T)is the xUnit-idiomatic pattern for shared setup — the fixture is instantiated once per test class.3. Split Overly-Large Test Method (MEDIUM PRIORITY)
Current Issue:
Parser_CanParseRealVektisFiletests multiple independent concerns in a single method:aantal_verzekerdejarencolumnIf the header count assertion fails, you never see whether the decimal parsing works, making diagnosis harder.
Recommended Refactor:
Split into focused, named tests: