You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using .Net Aspire, and looking to replace an API dependency with Wiremock.
The project "api" calls a downstream service "ingredients", that I want to mock.
I'm creating a http client for api, to create and send a request.
The code for the controller handling the request looks like this;
{[ApiController][Route("[controller]")]publicclassRecipesController: ControllerBase
{privatereadonlyILogger<RecipesController>_logger;privatereadonlyHttpClient_httpClient;
public RecipesController(ILogger<RecipesController>logger,IHttpClientFactoryhttpClientFactory){_logger=logger;_httpClient=httpClientFactory.CreateClient("ingredients");}[HttpGet(Name="GetRecipes")]publicobjectGet(){return_httpClient.GetAsync("/api/recipes").Result;}}}
I'm assuming that when the dependency for ingredients is resolved, we get a reference to the Wiremock instance. But this does not happen.
Hope this makes sense, or is this scenario not supported?
The text was updated successfully, but these errors were encountered:
I'm using .Net Aspire, and looking to replace an API dependency with Wiremock.
The project "api" calls a downstream service "ingredients", that I want to mock.
For example, in my test project, I have
I'm creating a http client for api, to create and send a request.
The code for the controller handling the request looks like this;
I'm assuming that when the dependency for ingredients is resolved, we get a reference to the Wiremock instance. But this does not happen.
Hope this makes sense, or is this scenario not supported?
The text was updated successfully, but these errors were encountered: