FakeItEasy 8.2.0

dotnet add package FakeItEasy --version 8.2.0
NuGet\Install-Package FakeItEasy -Version 8.2.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="FakeItEasy" Version="8.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FakeItEasy --version 8.2.0
#r "nuget: FakeItEasy, 8.2.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.
// Install FakeItEasy as a Cake Addin
#addin nuget:?package=FakeItEasy&version=8.2.0

// Install FakeItEasy as a Cake Tool
#tool nuget:?package=FakeItEasy&version=8.2.0

Are you mocking me?

NuGet version Build status

A .NET dynamic fake library for creating all types of fake objects, mocks, stubs etc.

  • Easier semantics, all fake objects are just that - fakes - the use of the fakes determines whether they're mocks or stubs.
  • Context-aware fluent interface guides the developer.
  • Designed for ease of use.
  • Full compatibility with both C# and VB.Net.

Faking amazing example

// Creating a fake object is very easy!
// No mocks, or stubs; everything's a fake.
var shop = A.Fake<ICandyShop>();

// Easily set up a call to return a value.
var lollipop = new Lollipop();
A.CallTo(() => shop.GetTopSellingCandy()).Returns(lollipop);

// Exercise your system under test by using the fake as you
// would an instance of the faked type.
var customer = new SweetTooth();
customer.BuyTastiestCandy(shop);

// Asserting uses the same syntax as configuring calls.
A.CallTo(() => shop.BuyCandy(lollipop)).MustHaveHappened();

Resources


FakeItEasy logo designed by Vanja Pakaski.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (160)

Showing the top 5 NuGet packages that depend on FakeItEasy:

Package Downloads
AutoFixture.AutoFakeItEasy The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

This extension turns AutoFixture into an Auto-Mocking Container. The mock instances are created by FakeItEasy. To use it, add the AutoFakeItEasyCustomization to your Fixture instance.

FakeXrmEasy.9 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Utilities to streamline unit testing in Dynamics CRM 365 by faking the IOrganizationService against an In-Memory context which runs blazing fast.

MockQueryable.FakeItEasy

Extension for mocking Entity Framework Core operations such ToListAsync, FirstOrDefaultAsync etc. When writing tests for your application it is often desirable to avoid hitting the database. The extension allows you to achieve this by creating a context – with behavior defined by your tests – that makes use of in-memory data.

Autofac.Extras.FakeItEasy The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Autofac extension supporting generation of FakeItEasy objects.

OBeautifulCode.AutoFakeItEasy

Makes FakeItEasy Dummies useful by wiring-them-up to real-looking, random test data. Leverages the power of AutoFixture to create anonymous variables. Fixes some of AutoFixture's poor default behaviors. Makes unit tests more expressive with less lines of code.

GitHub repositories (86)

Showing the top 5 popular GitHub repositories that depend on FakeItEasy:

Repository Stars
NancyFx/Nancy
Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
quartznet/quartznet
Quartz Enterprise Scheduler .NET
danielgerlag/workflow-core
Lightweight workflow engine for .NET Standard
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 6 and newer.
JanKallman/EPPlus
Create advanced Excel spreadsheets using .NET
Version Downloads Last updated
8.2.0 28,573 4/10/2024
8.1.0 694,929 1/5/2024
8.0.1 63,333 12/26/2023
8.0.0 435,857 11/7/2023
7.4.0 2,061,296 4/23/2023
7.3.1 5,884,961 3/8/2022
7.3.0 1,039,951 1/17/2022
7.2.0 2,055,100 9/1/2021
7.1.0 1,095,997 6/7/2021
7.0.2 423,298 5/4/2021
7.0.1 523,783 3/30/2021
7.0.0 276,709 3/15/2021
6.2.1 3,245,328 9/2/2020
6.2.0 588,911 7/23/2020
6.1.0 968,345 6/8/2020
6.0.1 821,271 4/10/2020
6.0.0 2,482,922 1/17/2020
5.5.0 1,568,276 11/25/2019
5.4.1 131,831 11/14/2019
5.4.0 299,692 10/23/2019
5.3.0 85,605 10/16/2019
5.2.0 631,812 9/5/2019
5.1.2 126,803 8/30/2019
5.1.1 1,461,155 4/15/2019
5.1.0 943,538 2/11/2019
5.0.1 247,325 1/14/2019
5.0.0 103,523 1/7/2019
4.9.2 250,096 12/13/2018
4.9.1 1,001,760 9/28/2018
4.9.0 679,337 9/27/2018
4.8.1 238,712 9/4/2018
4.8.0 265,149 8/8/2018
4.7.1 634,384 7/6/2018
4.7.0 27,838 7/3/2018
4.6.0 893,150 5/14/2018
4.5.1 628,228 2/28/2018
4.5.0 154,645 2/19/2018
4.4.0 132,447 2/6/2018
4.3.0 281,872 12/6/2017
4.2.0 223,843 11/8/2017
4.1.1 71,418 10/18/2017
4.1.0 93,911 10/10/2017
4.0.0 488,798 7/27/2017
3.4.2 217,402 6/19/2017
3.4.1 252,244 6/15/2017
3.3.2 170,996 5/4/2017
3.3.1 4,663 5/4/2017
3.3.0 5,701 5/4/2017
3.2.0 1,138,008 4/5/2017
3.1.0 94,485 3/10/2017
3.0.0 131,867 2/22/2017
2.3.3 186,562 1/18/2017
2.3.2 86,573 12/14/2016
2.3.1 315,016 9/30/2016
2.3.0 26,244 9/26/2016
2.2.0 191,629 7/14/2016
2.1.0 120,288 6/20/2016
2.0.0 209,496 5/25/2016
1.25.3 796,056 7/24/2015
1.24.0 92,761 8/25/2014
1.23.0 11,859 8/7/2014
1.22.0 53,341 6/17/2014
1.21.0 23,868 5/28/2014
1.20.0 11,061 5/6/2014
1.19.0 19,867 4/15/2014
1.18.0 95,177 3/5/2014
1.17.0 90,380 1/14/2014
1.16.0 5,928 1/9/2014
1.15.0 14,177 12/11/2013
1.14.0 30,440 10/24/2013
1.13.1 38,477 7/30/2013
1.12.0 19,080 5/27/2013
1.11.0 9,802 5/6/2013
1.10.0 12,384 3/28/2013
1.9.1 13,988 3/6/2013
1.8.0 38,739 2/12/2013
1.7.4626.65 34,285 8/31/2012
1.7.4582.63 10,815 7/18/2012
1.7.4574.62 4,888 7/10/2012
1.7.4507.61 11,609 5/4/2012
1.7.4257.42 21,185 8/28/2011
1.7.4166.27 12,747 5/29/2011
1.7.4117.2 6,424 4/10/2011
1.7.4109.1 275,218 4/2/2011
1.6.4075.221 7,401 3/1/2011
1.6.4062.205 6,940 2/14/2011
1.5.3970.199 7,678 1/7/2011
1.0.0.5 25,439 1/7/2011