lundi 2 décembre 2019

Assert C# (socialable) unit test does not use HTTP

We're building some "sociable" unit tests (tests that are larger than a "unit", but explicitly don't call out to external services or databases). I'm wondering if there is a way in C# to have the test runner throw an exception if a future developer writes a test that does call out.

Unfortunately, our system uses a variety of methods of calling external services -- RestSharp calls, HttpClient calls, WCF service calls, as well as SQL Server. If it was just one, I'd mock it and have an exception thrown, but because I have so many different places it could call out, I'm wondering if there is a way to prevent all of them at once to be sure. (knowing that SQL Server may be a different beast)

Aucun commentaire:

Enregistrer un commentaire