#StackBounty: #.net #braintree Whats the best approach for Unit Testing with braintree

Bounty: 50

I’m currently using the .NET SDK to process payments on my asp.net core project. I would like to automate tests using Unit Tests but it is proving difficult.

All the classes being used by the library – specifically “Subscription” and much more- have internal contructors or expect other internal instances. Options such as creating an instance from json to pass the it through a function is out.

It also not possible to construct an instance your self since the classes properties are all getters an with only the “*request” classes having setters but these arent’t of much help since the application won’t have to process them.

The Webhook test class is completely useless since the instance it gives is empty with only the id and status set. My application requires more data from a subscription such as the Transaction instance, Addons, Billing dates and more; all of which aren’t populated.

I have several classes that require testing and having to do them manually is simply impracticle and wastes a lot of time. Is there another approach i am missing?

Why is the library designed like this, it doesn’t seem very practicle in my opinion keeping the library so closed.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.