vendredi 25 août 2017

Asp.net core 2.0 remote testing and ef core mocking

I am developing web api(s) for an android app client. Now the developer of the client, wants a way to test web api(s) without getting the real data corrupt. So now I am thinking of something like unit testing and database (ef core) mocking in that except the requests are remote and stateless; so every time the client app requests for data or changing it, the database should remember the last things.

From the docs of Microsoft, there are two ways to do this on unit testing:

But the thing is that does are volatile and from on request to another request they will be refreshed. So I think SQLite (normal mode - file mode) will be a good solution. Now there are two questions:

  1. Is this a good idea or there is one better?
  2. If it is good, then how should I implement it?
  3. Is it good to add a header in the request?
  4. On the server-side code where should I tell the ef to use testing database?

Thanks in advance.

TG.

Aucun commentaire:

Enregistrer un commentaire