-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GatewayException constructor is marked as internal #20
Comments
Thanks for the feedback. It's all about scoping the objects. The constructor to the GatewayException object is marked internal as it's not intended for creation outside of the SDK. In the same vein the ResponseCode and ResponseMessages setters are private as they're only intended to be set by the class constructor. |
What would be your recommended approach for unit testing when a Gateway exception is thrown? |
I am not super familiar with Mock and how it works, so apologies in advance if these are poor suggestions. In your above example code it looks like you just want it to throw a GatewayException with a set response code/message whenever you call "Execute()". Seems to me you could create your own GatewayException object (GatewayExceptionEx) and throw that instead? |
Thanks very much for the feedback and suggestion. |
I am attempting to unit test some code when handling a GatewayException. I wish to mock the AuthorisationBuilder class and Setup Execute to throw a GatewayException. It is not possible as the ResponseCode and ResponseMessage setters are marked as private and the constructor to the class is marked as internal.
The code below will not compile as the constructor is internal.
Why would the constructor be marked as internal? Is there something I'm missing here?
The text was updated successfully, but these errors were encountered: