-
-
Notifications
You must be signed in to change notification settings - Fork 158
RFC: Fluent Testing API #294
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
Comments
Idea regarding Relates to #253 where wayne-o mentions something similar. Use case: currently have a microservice and a JADNC API. The microservice
The microservice currently also includes the JsonApiDotNetCore package to use it as a JA client. More specifically, it requires the deserializer for fetching data and the serializer for sending data. For this I currently need to build the
Some ideas on how to move forward with this:
|
@maurei thanks for the feedback (as always)! I'm in agreement that having a client library that can use the |
I'm closing this, because in the mean time we've done major refactorings on the test infrastructure code, resulting in our integration tests to no longer contain a lot of boilerplate code. |
Update: I am considering moving this as an add-on to DotnetTestAbstractions.
This is part of the initiative defined by #251.
Status: WIP (feedback desired)
Summary
Provide a fluent testing API that abstracts away the boilerplate required by most json:api requests.
Motivation
Currently, there is a lot of boilerplate required to test a single json:api endpoint. For example, this is one of the tests used against the example app in this repo:
JsonApiDotNetCore/test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/CreatingDataTests.cs
Lines 43 to 83 in a1832f7
We should be able to drastically reduce this to something a bit more readable:
Detailed Design
Create a new package
JsonApiDotNetCore.Testing
Possible APIs
JsonApiRequest<T>.SendAndValidateAsync()
JsonApiRequest<T>.SendAsync()
JsonApiRequest<T>.Dump()
CreateRequest<T>
GetRequest<T>
UpdateRequest<T>
DeleteRequest<T>
BulkRequest
IWriteRequest<T>.WithNewRelationship
relationships.{}.data
elementIRequest<T>.WithHeader
IGetRequest<T>.Filter
IGetRequest<T>.Sort
IGetRequest<T>.Sort
IGetRequest<T>.Include
IGetRequest<T>.Page
Considerations
WithNewRelationship
needs to be able to create the entity prior to sending the request)The text was updated successfully, but these errors were encountered: