Fast, friendly and familiar mocking library for modern .NET
$ dotnet add package MimicMimic 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.
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);
Strict = false on constructionReturns, Throws, Callback, When, Limit,
Expected, AsSequence and ProceedConsidering = ❓ | Planned = 📅 | In-Progress = 🚧
null for reference and default for value types when
Strict = false