You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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
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?
The text was updated successfully, but these errors were encountered: