Skip to content

Update HowToUseMapster sample to .NET 10 and fix age calculation - #2103

Open
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/73461-mapster-intro
Open

Update HowToUseMapster sample to .NET 10 and fix age calculation#2103
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/73461-mapster-intro

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Retargets the HowToUseMapster sample and its tests to net10.0 and bumps Mapster to 10.0.11 (with Mapster.Tool and Swashbuckle to current stable, plus refreshed test packages).

Replaces the naive DateTime.Now.Year - DateOfBirth.Year age rule with a leap-safe CalculateAge() helper built on DateOnly, which is off by a year before a person's birthday in the original. Adds two edge-case unit tests: a birthday already passed this year, and a 29 February birthday evaluated in a non-leap year.

Build and tests are green on net10.0 (6 tests passing). The Mapster code-generation tool runs cleanly under the .NET 10 SDK.

Retarget the project and tests to net10.0, bump Mapster to 10.0.11
(and the Mapster.Tool + Swashbuckle references to current stable),
and refresh the test packages. Replace the naive
DateTime.Now.Year - DateOfBirth.Year age rule with a leap-safe
CalculateAge() helper on DateOnly, and cover it with two edge-case
unit tests (birthday already passed; 29 February birthday in a
non-leap year).
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