concept mocked endpoint in category .net
appears as: mocked endpoints, mocked endpoints

This is an excerpt from Manning's book Microservices in .NET Core: with examples in Nancy.
Start the Loyalty Program microservice in separate processes, and configure it to use the mocked endpoints in place of the real collaborators. This means whenever Loyalty Program needs to call one of its collaborators, it will call one of the mocked endpoints.
Figure 7.5. A service-level test executes a scenario against the API of the microservice under test but configures the microservice to use mocked endpoints running in the same process as the test, in place of real collaborators. When a service-level test runs, it makes real HTTP requests to the microservice under test, which makes real HTTP requests back to mocked endpoints as needed. The test can inspect the responses from the microservice under test as well as the calls it makes to the mocked endpoints.
![]()
In the following line from listing 7.15, the event consumer doesn’t understand the command-line argument localhost:5001, which is the host name for the mocked endpoints you want the event consumer to use in place of the real collaborators: Arguments = "run localhost:5001",
Later, you’ll add a Fact method to this class: then, when you run xUnit, it will find this class and instantiate it to execute Fact. The constructor starts up Nancy, which will automatically discover the MockEventsFeed and MockUsersModule modules and expose the endpoints defined in them. This is all you need to create mocked endpoints in the service-level test process.