You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am unable to test my retry logic based on returned headers from AAD because I can't mock MsalServiceException with headers.
Headers and maybe some other properties of MsalServiceException have internal setter and there is no constructor that would set them.
Describe the solution you'd like
MsalServiceException should have a constructor for testing (like AuthenticationResult) that allows setting the headers and all other properties.
Describe alternatives you've considered
I tried to mock the exception, but it's not possible to mock field with internal setter.
I also tried to create my custom exception class that inherits from MsalServiceException, Headers property can't be overriden and hiding it doesn't work for my case, because the unit under test casts received exceptions to MsalServiceException.
I could create my own custom exception type and wrap the code calling MSAL with try catch and wrap the exception. This approach would probably work, it's ugly though and it could cause issues if I try to catch generic MsalException.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I am unable to test my retry logic based on returned headers from AAD because I can't mock MsalServiceException with headers.
Headers and maybe some other properties of MsalServiceException have internal setter and there is no constructor that would set them.
Describe the solution you'd like
MsalServiceException should have a constructor for testing (like AuthenticationResult) that allows setting the headers and all other properties.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: