Mocks.Maui 1.1.4

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Mocks.Maui --version 1.1.4
NuGet\Install-Package Mocks.Maui -Version 1.1.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mocks.Maui" Version="1.1.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mocks.Maui --version 1.1.4
#r "nuget: Mocks.Maui, 1.1.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mocks.Maui as a Cake Addin
#addin nuget:?package=Mocks.Maui&version=1.1.4

// Install Mocks.Maui as a Cake Tool
#tool nuget:?package=Mocks.Maui&version=1.1.4

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5-pre 40 5/1/2024
1.1.4 91 4/22/2024
1.1.2-pre 63 4/22/2024
1.1.1-pre 65 4/22/2024
1.1.0-pre 58 4/22/2024
1.0.9-pre 61 4/22/2024
1.0.8 82 4/21/2024
1.0.6-pre 66 4/21/2024
1.0.5 75 4/20/2024
1.0.4-pre 61 4/20/2024
1.0.0 71 4/20/2024

1.1.0
- Use synchronous timer (SyncTimer) in MockAnimationHandler as default

1.0.0
- MauiMocks class with Init and Reset methods