Skip to content

Comments

Document advanced property and indexer features#434

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/document-advanced-features
Closed

Document advanced property and indexer features#434
Copilot wants to merge 3 commits intomainfrom
copilot/document-advanced-features

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

  • Rebase on latest main (already up to date)
  • Restructure property documentation to integrate features inline
  • Restructure indexer documentation to integrate features inline
  • Update README.md to match new structure
  • Remove "Advanced Features" section headers
  • Add features directly to existing sections (Returns/Throws, Callbacks, etc.)
Original prompt

This section details on the original issue you should resolve

<issue_title>Document advanced property and indexer features</issue_title>
<issue_description>## Description

Several advanced property and indexer features are missing from the documentation.

Missing Documentation

  • .Returns(Func<T, T>) - Return value based on previous value
  • .OnGet.Do(Action<int, T>) - Getter callback with counter and value
  • .OnSet.Do(Action<int, T>) - Setter callback with counter and value
  • .Register() - Register setup without value

Suggested Documentation

Expand the Property Setup and Indexer Setup sections with:

  1. Advanced Property Returns (with previous value)
  2. Advanced Callbacks (with counter and value)
  3. Register Without Value

Advanced Property Returns

Return a value based on the previous value:

sut.SetupMock.Property.TotalDispensed
    .Returns((current) => current + 10);  // Increment by 10 each read

Advanced Callbacks

Access invocation counter and values in callbacks:

// Getter with counter and current value
sut.SetupMock.Property.TotalDispensed
    .OnGet.Do((int count, int value) => 
        Console.WriteLine($"Read #{count}, current value: {value}"));

// Setter with counter and new value
sut.SetupMock.Property.TotalDispensed
    .OnSet.Do((int count, int newValue) => 
        Console.WriteLine($"Set #{count} to {newValue}"));

Register Without Value

Register a setup without providing a value (useful with ThrowWhenNotSetup):

var strictMock = Mock.Create<IChocolateDispenser>(
    new MockBehavior { ThrowWhenNotSetup = true });

// Register property without value - won't throw
strictMock.SetupMock.Property.TotalDispensed.Register();
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: vbreuss <3438234+vbreuss@users.noreply.github.com>
Copilot AI changed the title [WIP] Document advanced property and indexer features Document advanced property and indexer features Jan 31, 2026
Copilot AI requested a review from vbreuss January 31, 2026 09:19
@vbreuss
Copy link
Contributor

vbreuss commented Jan 31, 2026

@copilot rebase this PR and add the missing features directly to the property and indexer setup sections respectively, as they are not really "advanced" but the normal documentation is too short or lacking.

…ction

Co-authored-by: vbreuss <3438234+vbreuss@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 31, 2026

@copilot rebase this PR and add the missing features directly to the property and indexer setup sections respectively, as they are not really "advanced" but the normal documentation is too short or la...

Done in d22b5b1. The features are now integrated directly into the existing sections:

Properties:

  • Returns with previous value added to "Returns / Throws" section
  • Callbacks with counter added to "Callbacks" section
  • Register added as new subsection

Indexers:

  • Returns with previous value added to second bullet point with example
  • Callbacks with counter added to third bullet point with example

The "Advanced Features" section headers have been removed from all files.

@vbreuss
Copy link
Contributor

vbreuss commented Jan 31, 2026

Obsolete by #443

@vbreuss vbreuss closed this Jan 31, 2026
@vbreuss vbreuss deleted the copilot/document-advanced-features branch February 5, 2026 17:04
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.

Document advanced property and indexer features

2 participants