Open Youssef1313 opened 1 year ago
@nickrandolph I'm not sure if this is actually possible today. So, if not possible, consider this as a feature request rather than documentation request.
This is already possible. If you look at the ToDo sample, it has mock services for use during Dev/test.
Cc @lukeblevins can we add this to the docs
This is already possible. If you look at the ToDo sample, it has mock services for use during Dev/test.
I'm not able to find these mock services.
This is already possible. If you look at the ToDo sample, it has mock services for use during Dev/test.
I'm not able to find these mock services.
Here's where one of them is registered: https://github.com/unoplatform/uno.todo/blob/824c6c4cb54b19f9ae98164d975fa2551ec3bc96/src/ToDo/ServiceCollectionExtensions.cs#L23
GitHubUno Platform "Uno To Do" reference app. Contribute to unoplatform/uno.todo development by creating an account on GitHub.
Oh I was looking in https://github.com/unoplatform/uno.extensions/tree/main/testing/TestHarness/TestHarness.Shared/Ext/Navigation/Apps/ToDo.
Though the current approach isn't too flexible. I'm looking for something more similar to https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-7.0#inject-mock-services
With some reflection, I achieved a similar result. I have not tested this for Uno host but for the generic host it works. @Youssef1313 I can share the code but it is in F# Unfortunately MS had not opened the necessary APIs to call them directly
Scenario:
The app uses an implementation of a specific service that connects to a server. The developer wants to create a mock implementation for that service for purpose of service.