Cannot create FunctionFailedException in unit test #753
Labels
Enhancement
Feature requests.
fix-ready
Indicates that an issue has been fixed and will be available in the next release.
Milestone
I am creating unit tests for my orchestrator function, following the guidance on https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-unit-testing .
I wish to test the logic that handles one of my activity tasks throwing an exception. The orchestrator handles this with
However, I am unable to mock the call to
CallActivityAsync
and have it throw as all constructors ofFunctionFailedException
are internal. AsException.InnerException
is not virtual, I also cannot useMock.Of<FunctionFailedException>(ex => ex.InnerException == new MyCustomException())
I have been able to resolve this temporarily by using reflection, but I doubt this is the expected approach. Is this not something that should be tested for some reason, or is there an official way to do so?
The text was updated successfully, but these errors were encountered: