Mimic 0.6.0

dotnet add package Mimic --version 0.6.0
                    
NuGet\Install-Package Mimic -Version 0.6.0
                    
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="Mimic" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mimic" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Mimic" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mimic --version 0.6.0
                    
#r "nuget: Mimic, 0.6.0"
                    
#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.
#:package Mimic@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mimic&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Mimic&version=0.6.0
                    
Install as a Cake Tool

Mimic

Fast, friendly and familiar mocking library for modern .NET

GitHub Release NuGet Downloads Build Status Codecov

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 and Proceed
  • 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 and default for value types when Strict = false
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.  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. 
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
0.6.0 141 6/22/2025
0.5.0 194 2/7/2024
0.4.0 224 12/14/2023
0.3.2 180 11/18/2023
0.2.0 192 10/27/2023
0.1.0 186 10/22/2023