Description
AutoMoqer is an "auto-mocking" container that creates objects for you. Just tell it what class to create and it will create it.
AutoMoq alternatives and similar packages
Based on the "Testing" category.
Alternatively, view AutoMoq alternatives based on common mentions on social networks and blogs.
-
Bogus
A simple and sane fake data generator for C#. Based on and ported from the famed faker.js. -
xUnit
xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework -
AutoFixture
AutoFixture is an open source framework for .NET designed to minimize the 'Arrange' phase of your unit tests -
Fluent Assertions
A set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test -
Shouldly
Shouldly is an assertion framework which focuses on giving great error messages when the assertion fails while being simple and terse. -
FakeItEasy
The easy mocking library for .NET http://fakeiteasy.github.io -
Machine.Specifications
Machine.Specifications (MSpec) is a context/specification framework that removes language noise and simplifies tests. -
Compare-Net-Objects
Perform a deep compare of any two .NET objects using reflection. Shows the differences between the two objects. -
GenFu
GenFu is a library you can use to generate realistic test data. It is composed of several property fillers that can populate commonly named properties through reflection using an internal database of values or randomly created data. You can override any of the fillers, give GenFu hints on how to fill them. -
Canopy
Canopy is a free, open source F# web automation and testing framework -
Expecto
A smooth testing framework for F# with tests as values. Unit testing, property based testing, performance testing and stress testing. -
xBehave.net
A BDD/TDD framework based on xUnit.net and inspired by Gherkin. http://xbehave.github.io -
NSpec
A battle hardened testing framework for C# that's heavily inspired by Mocha and RSpec. -
SpecsFor
SpecsFor is a light-weight Behavior-Driven Development framework that focuses on ease of use for *developers* by minimizing testing friction. -
LightBDD
BDD framework allowing to create easy to read and maintain tests. -
Verify
Verification tool to enable simple approval of complex models and documents. -
SimpleStubs
*SimpleStubs* is a simple mocking framework that supports Universal Windows Platform (UWP), .NET Core and .NET framework. SimpleStubs is currently developed and maintained by Microsoft BigPark Studios in Vancouver. -
ExpressionToCode
Use plain C# syntax in assertions that include both the expression expression and subexpression values in the failure message. -
ArchUnitNET
Simple library for checking the architecture of C# code with a fluent API. -
snapshooter
Snapshooter is a snapshot testing tool for .NET Core and .NET Framework -
Fuchu
A unit-testing library for F# with tests-as-values which makes DSLs extemely easy to create. -
Fine Code Coverage
Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too) -
ReportPortal
AI-powered Test Automation Dashboard. Acquire, aggregate and analyze test reports to ascertain release health. -
NCrunch
An automated continuous & concurrent testing tool for Visual Studio. [$]
Scout APM - Leading-edge performance monitoring starting at $39/month
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of AutoMoq or a related project?
Popular Comparisons
README
AutoMoq
AutoMoqer is an "auto-mocking" container that creates objects for you. Just tell it what class to create and it will create it.
But how?
It injects mocks as any undefined dependencies.
class NeatoRepository {
public NeatoRepository(ISomething something){
// ..
}
}
var mocker = new AutoMoqer();
var neatoRepository = mocker.Create<NeatoRepository>();
// but what about ISomething?
mocker.GetMock<ISomething>(); // I was injected as ISomething
But why?
Let's pretend you did not use AutoMoq and you changed your dependencies:
// I wrote this code in my tests...
var neatoRepository = new NeatoRepository(null);
// ... then I changed my class...
class NeatoRepository {
public NeatoRepository(ISomething something, ISomethingElse somethingElse){
// ..
}
}
// NOW I HAVE TO FIX ALL OTHER REFERENCES TO GET A BUILD
var neatoRepository = new NeatoRepository(null);
If you used AutoMoq, this could would always compile:
var neatoRepository = mocker.Create<NeatoRepository>();
Leaving you to just worry about how to change your logic, not your syntax.
Another Example
The dependencies injected into the class you are testing can be accessed before and/or after you call Create. Like so:
var mocker = new AutoMoqer();
mocker.GetMock<IDataDependency>()
.Setup(x => x.GetData())
.Returns("TEST DATA");
var classToTest = mocker.Resolve<ClassToTest>();
classToTest.DoSomething();
mocker.GetMock<IDependencyToCheck>()
.Setup(x=>x.CallMe("TEST"), Times.Once());
That's It
It's a simple tool, but it can save a lot of headaches.