Mocks.Maui
1.0.6-pre
See the version list below for details.
dotnet add package Mocks.Maui --version 1.0.6-pre
NuGet\Install-Package Mocks.Maui -Version 1.0.6-pre
<PackageReference Include="Mocks.Maui" Version="1.0.6-pre" />
paket add Mocks.Maui --version 1.0.6-pre
#r "nuget: Mocks.Maui, 1.0.6-pre"
// Install Mocks.Maui as a Cake Addin #addin nuget:?package=Mocks.Maui&version=1.0.6-pre&prerelease // Install Mocks.Maui as a Cake Tool #tool nuget:?package=Mocks.Maui&version=1.0.6-pre&prerelease
MauiMocks
MauiMocks facilitates service mocking in unit tests for .NET MAUI test projects.
Download and Installation
This library is available on NuGet: https://www.nuget.org/packages/Mocks.Maui To install MauiMocks via NuGet package manager console, use the following command:
PM> Install-Package Mocks.Maui
This library is compatible with any .NET MAUI test project running on .NET 8 and newer.
API Usage
While many UI classes in a .NET MAUI project are readily usable in unit tests, certain classes rely on services registered in the DI container or initialized during app startup. MauiMocks aids in mocking all essential services from .NET MAUI, enabling unit test execution without the need to fully deploy the app on a device/simulator.
Initializing MauiMocks
In the setup section of your unit test, execute the following code to prepare .NET MAUI for testing:
MauiMocks.Init();
Ensure that unit tests utilizing this code are not executed concurrently, as this may lead to unpredictable outcomes.
Issues & Inquiries
If you encounter a bug or wish to propose a new feature, please feel free to do so by opening a new issue here.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.Maui.Controls (>= 8.0.7)
- Microsoft.Maui.Controls.Compatibility (>= 8.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.19-pre | 76 | 1/1/2025 |
1.1.18-pre | 71 | 12/1/2024 |
1.1.17-pre | 260 | 11/1/2024 |
1.1.15-pre | 86 | 10/1/2024 |
1.1.14-pre | 103 | 9/1/2024 |
1.1.13-pre | 109 | 8/17/2024 |
1.1.12-pre | 152 | 8/1/2024 |
1.1.11-pre | 141 | 7/1/2024 |
1.1.10-pre | 106 | 6/21/2024 |
1.1.9-pre | 91 | 6/1/2024 |
1.1.8 | 5,353 | 5/20/2024 |
1.1.6-pre | 64 | 5/15/2024 |
1.1.5-pre | 104 | 5/1/2024 |
1.1.4 | 259 | 4/22/2024 |
1.1.2-pre | 101 | 4/22/2024 |
1.1.1-pre | 86 | 4/22/2024 |
1.1.0-pre | 98 | 4/22/2024 |
1.0.9-pre | 93 | 4/22/2024 |
1.0.8 | 121 | 4/21/2024 |
1.0.6-pre | 100 | 4/21/2024 |
1.0.5 | 115 | 4/20/2024 |
1.0.4-pre | 93 | 4/20/2024 |
1.0.0 | 112 | 4/20/2024 |
1.0.0
- MauiMocks class with Init and Reset methods