Skip to content

Add no-DB unit tests using pengdows.crud.fakeDb, reaching 86% line coverage#2199

Open
alaricd wants to merge 3 commits intoDapperLib:mainfrom
pengdows:increase-unit-test-coverage
Open

Add no-DB unit tests using pengdows.crud.fakeDb, reaching 86% line coverage#2199
alaricd wants to merge 3 commits intoDapperLib:mainfrom
pengdows:increase-unit-test-coverage

Conversation

@alaricd
Copy link

@alaricd alaricd commented Mar 22, 2026

….dll coverage

Introduces 775 pure unit tests that run without a live database connection,
using pengdows.crud.fakeDb v2.0.1 as a fake ADO.NET provider. Tests target

Coverage achieved:

  • Dapper.dll overall: 86.1% (up from ~0% no-DB coverage)
  • SqlMapper.cs: 82.3% (exceeds 80% goal)
  • CommandDefinition.cs, UdtTypeHandler.cs, SqlDataRecordHandler.cs, SqlDataRecordListTVPParameter.cs: 100%

Key areas covered by new FakeDbTests.*.cs files:

  • All Query/Execute/QueryMultiple sync and async overloads
  • MultiMap (2–7 types), dynamic multimap, GridReader
  • DynamicParameters, TypeHandlers, TypeMapping, DefaultTypeMap
  • PassByPosition (?x? syntax), TryStringSplit (InListStringSplitCount), PadListExpansions, empty IN-list handling
  • Format() all TypeCode branches, ReplaceLiterals, ReadChar/ReadNullableChar
  • SanitizeParameterValue for all enum underlying types
  • CommandDefinition.GetInit() IL generation (BindByName, FetchSize, etc.)
  • StructuredHelper.ConfigureTVP/ConfigureUDT IL generation and cache
  • WrappedReader, WrappedBasicReader, DisposedReader, DbString, ValueTuples
  • Struct params, ctor-sort params, pipelined Execute, error paths

alaricd and others added 3 commits March 22, 2026 13:58
….dll coverage

  Introduces 775 pure unit tests that run without a live database connection,
  using pengdows.crud.fakeDb v2.0.1 as a fake ADO.NET provider. Tests target

  Coverage achieved:
  - Dapper.dll overall: 86.1% (up from ~0% no-DB coverage)
  - SqlMapper.cs: 82.3% (exceeds 80% goal)
  - CommandDefinition.cs, UdtTypeHandler.cs, SqlDataRecordHandler.cs,
    SqlDataRecordListTVPParameter.cs: 100%

  Key areas covered by new FakeDbTests.*.cs files:
  - All Query/Execute/QueryMultiple sync and async overloads
  - MultiMap (2–7 types), dynamic multimap, GridReader
  - DynamicParameters, TypeHandlers, TypeMapping, DefaultTypeMap
  - PassByPosition (?x? syntax), TryStringSplit (InListStringSplitCount),
    PadListExpansions, empty IN-list handling
  - Format() all TypeCode branches, ReplaceLiterals, ReadChar/ReadNullableChar
  - SanitizeParameterValue for all enum underlying types
  - CommandDefinition.GetInit() IL generation (BindByName, FetchSize, etc.)
  - StructuredHelper.ConfigureTVP/ConfigureUDT IL generation and cache
  - WrappedReader, WrappedBasicReader, DisposedReader, DbString, ValueTuples
  - Struct params, ctor-sort params, pipelined Execute, error paths
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AppVeyor's VS 2022 image only ships up to SDK 9.0.306; the 10.0.102
requirement in global.json prevented dotnet from running at all.
Dapper.csproj had no NET10_0_OR_GREATER guards, so the net10.0
target was identical to net8.0 and safe to remove.

rollForward: latestMajor remains, so machines with SDK 10+ continue
using the latest available SDK.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alaricd
Copy link
Author

alaricd commented Mar 22, 2026

@mgravell — build is now green. 775 pure unit tests, no live database required, using pengdows.crud.fakeDb as a fake ADO.NET provider. Test-only dependency, zero production code changes. Happy to address any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant