Mimic 0.6.0
dotnet add package Mimic --version 0.6.0
NuGet\Install-Package Mimic -Version 0.6.0
<PackageReference Include="Mimic" Version="0.6.0" />
<PackageVersion Include="Mimic" Version="0.6.0" />
<PackageReference Include="Mimic" />
paket add Mimic --version 0.6.0
#r "nuget: Mimic, 0.6.0"
#:package Mimic@0.6.0
#addin nuget:?package=Mimic&version=0.6.0
#tool nuget:?package=Mimic&version=0.6.0
Mimic
Fast, friendly and familiar mocking library for modern .NET
What is Mimic | Features | Roadmap | Changelog
Mimic is still very early in it's development and the functionality and/or interfaces that it provides are subject to change without warning between versions until the v1 release.
What is Mimic
Mimic is a friendly and familiar mocking library built for modern .NET built on top of the Castle Project's dynamic proxy generator. It's simple, intuitive and type-safe API for configuring mimic's of interfaces/classes allows for both; Setup of return values for methods/properties and verifying if method calls have been received after the fact.
var mimic = new Mimic<ITypeToMimic>();
// Easily setup methods
mimic.Setup(m => m.IsMimicEasyToUse(Arg.Any<string>()))
.Returns(true);
// Access the `Object` property to generate an implementation of `ITypeToMimic` and call our setup method
ITypeToMimic mimickedObject = mimic.Object;
bool whatDoYouThink = mimickedObject.IsMimicEasyToUse("it's so intuitive");
// Verify that the specified method has been called at least once on the `Object`
mimic.VerifyReceived(m => m.IsMimicEasyToUse("it's so intuitive"), CallCount.AtLeastOnce);
Features
- A friendly interface designed to ease adoption by users of other popular .NET mocking libraries
- Support for generating mock objects of interfaces and overridable members in classes
- Intuitive and type-safe expression based API for setups and verification of methods
- Mimic is strict by default, meaning it throws for methods without a corresponding setup, but it's possible to
disable the default behaviour by setting
Strict = false
on construction - Quick and easy stubbing of properties to store and retrieve values
- Implicit mocking of interfaces returned by mimicked methods allowing for easy setup of nested calls
- Comprehensive set of behaviours for method setups such as;
Returns
,Throws
,Callback
,When
,Limit
,Expected
,AsSequence
andProceed
- Verification of expected, setup and received calls including asserting no additional calls
Roadmap
Considering = ❓ | Planned = 📅 | In-Progress = 🚧
- [❓] Setup and Verification of Event's
- [❓] Configurable default return values instead of just
null
for reference anddefault
for value types whenStrict = false
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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Castle.Core (>= 5.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.