Skip to content
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

How to inject a mocked repository into the provider via the middleware (.net core) #9

Open
pedramp20 opened this issue Apr 3, 2019 · 0 comments

Comments

@pedramp20
Copy link

pedramp20 commented Apr 3, 2019

In cases where the provider state needs to be set prior to the test (For instance when an entity needs to exist in the database with a specific id), what are the best practices to update the state of the provider? From my perspective, there should be a way to mock the repository so that data can be manipulated easily and quickly, if this is the right approach, how is it possible to inject a mocked repository into the provider?
Since, the test does not run the server and an instance of the Provider API needs to be run independently, I can't get my head around a solution, which allows dynamic injection of a mocked repository.
If this is not possible, then how is it possible to update the state in the Provider? Does it mean that the provider endpoints (i.e. POST) should be called or data should be inserted directly to the database from the middleware? Even if these approaches are implemented, the Id of the created object is auto incremented and would not match the contract. Does it mean that I have to use Matching in the contract? What is the best practice to implement tear down and cleanup the changes then?

@pedramp20 pedramp20 changed the title How to inject a mocked repository in the middleware (.net core) How to inject a mocked repository into the provider via the middleware (.net core) Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant