Skip to content

Add index-aware Impose on lists and selections - #8

Merged
holonsoftFounder merged 1 commit into
mainfrom
feature/index-aware-impose
Sep 9, 2026
Merged

Add index-aware Impose on lists and selections#8
holonsoftFounder merged 1 commit into
mainfrom
feature/index-aware-impose

Conversation

@holonsoftFounder

Copy link
Copy Markdown
Member

Summary

  • Impose(member, i => value) and Impose(member, (i, item) => value) on ICollectionContext and ICollectionSequenceSelectionContext. The index is the position in the whole list (0 based), also inside First/Next and after Random: the generators now travel with their position (IndexedGenerator<TPoco>).
  • Impose(member, item => value) on IObjectGenerator, backed by ObjectMemberSetFromFuncAction. The lambda runs after the configured sources and after every Impose registered before it, so it sees generated and imposed members.
  • The classic Impose(member, value) and all other members are unchanged; the old selection-context constructor taking plain generators is kept.
  • README example and release notes.

Test plan

  • 16 new tests: unit tests with mocks for both contexts (position per item, selection only, position kept after Random, null factories), action tests for properties, fields, rejection of methods and nulls; integration for ids from the index, emails from generated members, earlier Impose visible, selection positions, Random keeps original positions, single generator, fields, mixing with the classic Impose
  • dotnet build -c Release zero warnings
  • 813 tests green per framework on net8, net9, net10 (Windows)
  • Manual run of a file based app: ids 1..8, emails from names and index, First tags 0..2, Random tags at their original positions

🤖 Generated with Claude Code

ICollectionContext and ICollectionSequenceSelectionContext get Impose(member,
i => value) and Impose(member, (i, item) => value); the index is the position
in the whole list, kept through First/Next and Random via IndexedGenerator.
IObjectGenerator gets Impose(member, item => value), backed by the new
ObjectMemberSetFromFuncAction, which runs after the configured sources and
after every Impose registered before it. Tests, README and release notes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@holonsoftFounder
holonsoftFounder merged commit a6023c3 into main Sep 9, 2026
2 checks passed
@holonsoftFounder
holonsoftFounder deleted the feature/index-aware-impose branch September 9, 2026 12:14
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