How to implement a consumer-driven test

In the case of microservices, it's a bit challenging/harder to implement a consumer-driven test instead of a .NET monolithic application. This is because in monolithic applications, we can directly use any unit test framework, such as MS tests or NUnit, but we can't do this directly in the microservice architecture. In microservices, we would need to mock not only method calls, but also the services themselves, which get called via either HTTP or HTTPs.

To implement a consumer-driven test, there are tools available that will help. One famous open source tool for .NET framework is Pact-net (https://github.com/SEEK-Jobs/pact-net) and another for .NET Core is Pact-net-core (https://github.com/garora/pact-net-core ...

Get Building Microservices with .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.