Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a Register() method to the property setup API, allowing properties to be registered without specifying a value. This is particularly useful when using MockBehavior.ThrowWhenNotSetup, as it enables properties to be marked as "setup" without defining specific behavior, preventing MockNotSetupException from being thrown when the property is accessed.
Key changes:
- Added
Register()method toIPropertySetup<T>interface with XML documentation - Implemented
Register()inPropertySetup<T>class (returnsthisfor fluent chaining) - Added comprehensive tests validating both the exception scenario without registration and successful registration behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Source/Mockolate/Setup/Interfaces.PropertySetup.cs | Added Register() method signature to the property setup interface with XML documentation |
| Source/Mockolate/Setup/PropertySetup.cs | Implemented the Register() method returning this for method chaining |
| Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.RegisterTests.cs | Added test class with two tests validating registration behavior with ThrowingWhenNotSetup mode |
Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.RegisterTests.cs
Show resolved
Hide resolved
🚀 Benchmark ResultsDetails
|
|
|
This is addressed in release v0.48.0. |



This PR adds a
Register()method to the property setup API, allowing properties to be registered without specifying a value. This is particularly useful when usingMockBehavior.ThrowWhenNotSetup, as it enables properties to be marked as "setup" without defining specific behavior, preventingMockNotSetupExceptionfrom being thrown when the property is accessed.Key changes
Register()method toIPropertySetup<T>interface with XML documentationRegister()inPropertySetup<T>class (returnsthisfor fluent chaining)