Question
I am using for each test and each test object redirections of calls to a singleton Substitute, requirement from the project.
So for each test I am adding custom Redirect handler.
ICallRouter callRouterFor = SubstitutionContext.Current.GetCallRouterFor(substitute); callRouterFor .RegisterCustomCallHandlerFactory( factory: _ => new RedirectAllHandler(target));
Problem:
Each test is creating new redirect but I am not able to remove them in the test teardown. ClearSubstitute() method is clearing other aspects of substitute but it is not clearing CustomHandlers.
I was looking for the way to clear/dispose object from CustomHandlers but I am unable to find it. Probably my use case is weird and for normal setup this is not required to clear this list.
Question: Is there a method or option to invert RegisterCustomCallHandlerFactory?? Or Clear CustomHandlers for each test and completely "Reset" Substitute?
Regars
Question
I am using for each test and each test object redirections of calls to a singleton Substitute, requirement from the project.
So for each test I am adding custom Redirect handler.
ICallRouter callRouterFor = SubstitutionContext.Current.GetCallRouterFor(substitute); callRouterFor .RegisterCustomCallHandlerFactory( factory: _ => new RedirectAllHandler(target));Problem:
Each test is creating new redirect but I am not able to remove them in the test teardown. ClearSubstitute() method is clearing other aspects of substitute but it is not clearing CustomHandlers.
I was looking for the way to clear/dispose object from CustomHandlers but I am unable to find it. Probably my use case is weird and for normal setup this is not required to clear this list.
Question: Is there a method or option to invert RegisterCustomCallHandlerFactory?? Or Clear CustomHandlers for each test and completely "Reset" Substitute?
Regars