A .NET dynamic fake library for creating all types of fake objects, mocks, and stubs with easy semantics.
FakeItEasy is a dynamic fake library for .NET that creates fake objects, mocks, and stubs to simplify unit testing. It replaces real dependencies with controllable fakes, allowing developers to isolate and test components effectively. The library uses a unified approach where all test doubles are called "fakes," eliminating the distinction between mocks and stubs.
.NET developers writing unit tests who need to mock dependencies, particularly those practicing Test-Driven Development (TDD) or looking for a simpler alternative to complex mocking frameworks.
Developers choose FakeItEasy for its exceptionally clean and intuitive API that guides them through the mocking process, reducing cognitive load compared to other mocking libraries. Its context-aware fluent interface and unified fake semantics make it easier to learn and use while maintaining full compatibility with both C# and VB.NET.
The easy mocking library for .NET
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
All test doubles are simply 'fakes,' eliminating confusion between mocks and stubs, as demonstrated in the example where A.Fake<ICandyShop> creates a single type of fake object.
The context-aware fluent interface provides clear syntax suggestions, evident in A.CallTo(() => shop.GetTopSellingCandy()).Returns(lollipop) for easy setup.
Works seamlessly with both C# and VB.NET across multiple .NET versions, including .NET Framework 4.6.2 and .NET 8.0/10.0, as listed in the NuGet package targets.
Uses the same fluent interface for configuring and verifying calls, making tests consistent and readable, shown with A.CallTo(() => shop.BuyCandy(lollipop)).MustHaveHappened().
Relies on runtime proxy generation, which can slow down test execution compared to static or compile-time mocking approaches in some scenarios.
Prioritizes simplicity over niche capabilities, such as complex property behavior or partial mocking, which are more robust in libraries like Moq.
Has a less mature community and fewer third-party integrations compared to established alternatives, potentially limiting tooling and support options.