kolan72 / PoliNorError

PoliNorError is a library that provides error handling capabilities through Retry and Fallback policies. The library has a specific focus on handling potential exceptions within the catch block and offers various configuration options.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The `PolicyDelegateCollectionResult<T>.LastPolicyResult.PolicyResultHandlingErrors` collection should be empty after handling delegate by `PolicyCollection` with a `PolicyResult` handler that has a different type than the delegate return type.

kolan72 opened this issue · comments

commented

This test failed, but it should be green:

[Test]
public void Should_No_PolicyResultHandlingErrors_If_Handler_For_OtherType_Than_PolicyResult_Result()
{
	var result = PolicyCollection.Create()
			.WithRetry(2)
			.WithFallback(() => new List<string>() { "1", "2" })
			.AddPolicyResultHandlerForAll<List<string>>(pr => { })
			.AddPolicyResultHandlerForAll<int>(pr => { })
			.HandleDelegate<List<string>>(() => throw new Exception("Test"));

	Assert.AreEqual(0, result.LastPolicyResult.PolicyResultHandlingErrors.Count());
}