-
Notifications
You must be signed in to change notification settings - Fork 571
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
Recommended strategy for stubbing entities in unit tests in version 27.0.0 #1651
Comments
Fully agree. I was waiting for Immutables dependency to drop only to now get a bunch of broken tests... At least make all that read-only properties virtual to allow mocking. |
Hi, thanks for the report and sorry for the inconvenience. We changed the way expandable fields are handled, and in the process removed setters for the ID and expanded versions of these fields, but failed to realize these setters were useful for unit tests/mocking. We'll add the setters back and publish a new version soon. |
Fixed in 27.1.0. |
While setters are back and code compiles, when trying to set a Customer or CustomerId properties of say a Charge throws NullReferenceException. Are charges being tested at all before releasing? |
OS version: Windows 10
.NET Core version: 2.2
Stripe.net version: 27.0.0
Before version 27.0.0 it was trivial to create unit tests with mocking/stubbing behavior, e.g.
In version 27.0.0 the method above no longer compiles because many of the core resources (e.g. Customer) now contain properties that are readonly.
What's the recommended approach for creating stubbed resources (e.g. a
Customer
withDefaultSourceId
set to a test value) now? Of course we could create our own wrapper objects for all your entities, but this would be a maintenance pain.We're concerned that you guys have neglected unit-test considerations with version 27.0.0.
The text was updated successfully, but these errors were encountered: