Skip to content

Ability to mock protected methods with and without return value - #845

Merged
dtchepak merged 4 commits into
nsubstitute:mainfrom
Jason31569:main
Mar 9, 2025
Merged

Ability to mock protected methods with and without return value#845
dtchepak merged 4 commits into
nsubstitute:mainfrom
Jason31569:main

Conversation

@Jason31569

Copy link
Copy Markdown
Contributor

Closes #800

@Jason31569 Jason31569 changed the title Ability to mock protected methods with and without return types (void) Ability to mock protected methods with and without return value Nov 20, 2024
@dtchepak
dtchepak requested a review from Romfos November 30, 2024 08:22

@dtchepak dtchepak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! WDYT @Romfos ?

Comment thread src/NSubstitute/Extensions/ProtectedExtensions.cs Outdated
Comment thread src/NSubstitute/Core/ThreadLocalContext.cs Outdated
Comment thread src/NSubstitute/Extensions/ProtectedExtensions.cs
… unit tests to verify error conditions

* Rename unit tests with better description
* Fix unit test failure due to orphaned argument spec when previous setup throws
@leus

leus commented Jan 6, 2025

Copy link
Copy Markdown

holding my breath for this one.

@dtchepak

Copy link
Copy Markdown
Member

Hi @Romfos ,

Just wanted to check you're happy with this change?

@Romfos

Romfos commented Feb 16, 2025

Copy link
Copy Markdown
Contributor

@dtchepak sorry, I'm not fully qualified how this part of code is working. Could you please review by yourself?

@Jason31569

Copy link
Copy Markdown
Contributor Author

@dtchepak let me know if you have any additional suggestions or if you're happy to merge this? Thank you.

@dtchepak dtchepak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. Looks great, thanks!

Comment thread tests/NSubstitute.Acceptance.Specs/ProtectedExtensionsTests.cs
This was referenced Aug 12, 2026
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.

Ability to mock requests from Protected methods in sequences

4 participants