Testing C# app backed by MSSQL database and Entity Framework - seeking advices for going with "test double" approach
I am new to C#, and Windows (coming from Python, Linux background). I need to add tests to an existing C# codebase, which relies on a MSSQL database and Entity Framework. In my old days when testing Python applications based on Redis, I could easily start Redis and write my tests which would interact with Redis like the real application ; this is what I call "test double" approach (I was building a test double of the real Redis instance for the tests). I wonder if it is possible to have the same approach for the C# application. More precisely I would like: to start MSSQL server somehow when test suite starts to populate it with a .bacpac file, to give initial structure and data to MSSQL to write tests, which would connect to this database instead of the production one I have configuration file for this, no problem I could check database contents etc then, when test suite is finished, this database should stop Which tools or approach should I use for this ? I have no Windows experience at all unfortunately. If it is too cumbersome, maybe I can try to have a Sqlite instance instead of the full-fledge MSSQL server... Any advice would be appreciated!
I am new to C#, and Windows (coming from Python, Linux background). I need to add tests to an existing C# codebase, which relies on a MSSQL database and Entity Framework.
In my old days when testing Python applications based on Redis, I could easily start Redis and write my tests which would interact with Redis like the real application ; this is what I call "test double" approach (I was building a test double of the real Redis instance for the tests).
I wonder if it is possible to have the same approach for the C# application.
More precisely I would like:
- to start MSSQL server somehow when test suite starts
- to populate it with a .bacpac file, to give initial structure and data to MSSQL
- to write tests, which would connect to this database instead of the production one
- I have configuration file for this, no problem
- I could check database contents etc
- then, when test suite is finished, this database should stop
Which tools or approach should I use for this ? I have no Windows experience at all unfortunately.
If it is too cumbersome, maybe I can try to have a Sqlite instance instead of the full-fledge MSSQL server...
Any advice would be appreciated!
What's Your Reaction?