Implementation of IsOkAnd and IsErrAnd #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
Implementation:
The methods
IsOkAnd
andIsErrAnd
have been added to allow checking the status of Result objects.Both methods accept a predicate delegate that is applied to the corresponding value when the result is in the desired state.
Null Check:
Ensured that the predicates are checked for null before being applied to the values to avoid null reference exceptions.
Documentation:
XML documentation for the new methods has been added to clarify their usage and functionality.
Tests:
Unit tests have been written to verify the correct functionality of the new methods and to ensure that the predicates are evaluated properly.
All new tests have passed successfully, confirming the correct implementation of the functionality.
Motivation:
The introduction of these methods enhances the handling of Result objects by providing a clearer and safer way to check the status of results and validate associated conditions. This contributes to more robust error handling in the application.