Replies: 2 comments 2 replies
-
Please provide some code that demonstrates the issue. |
Beta Was this translation helpful? Give feedback.
-
Based on your really vague description it is hard to provide any valuable suggestions. BUT let me try to assist you by making an assumption: You have a policy definition which triggers only if the decorated method does not return the expected value. For the sake of simplicity lets assume the definition looks something like this: var retry = Policy
.HandleResult<int>(result => result != expectedResult)
.Retry(2); then all you need to do is to capture the result of the Something like this [Fact]
public void Test1()
{
//Arrange
const int expectedResult = 42;
var retry = Policy
.HandleResult<int>(result => result != expectedResult)
.Retry(2);
//Act
var actualResult = retry.Execute(() => 41);
//Assert
Assert.Equal(expectedResult, actualResult);
} |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a TryAndRetry function where I Retry if result != expectedResult, however when it reaches max retries, my tests pass and no exception is thrown from .HandleResult(). Could anyone help?
Beta Was this translation helpful? Give feedback.
All reactions