FakeItEasy 8.3.0

dotnet add package FakeItEasy --version 8.3.0
                    
NuGet\Install-Package FakeItEasy -Version 8.3.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.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FakeItEasy" Version="8.3.0" />
                    
Directory.Packages.props
<PackageReference Include="FakeItEasy" />
                    
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 FakeItEasy --version 8.3.0
                    
#r "nuget: FakeItEasy, 8.3.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.
#addin nuget:?package=FakeItEasy&version=8.3.0
                    
Install FakeItEasy as a Cake Addin
#tool nuget:?package=FakeItEasy&version=8.3.0
                    
Install FakeItEasy as a Cake Tool

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.  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. 
.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 (174)

Showing the top 5 NuGet packages that depend on FakeItEasy:

Package Downloads
AutoFixture.AutoFakeItEasy

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

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

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 (98)

Showing the top 20 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
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 8 and newer.
JanKallman/EPPlus
Create advanced Excel spreadsheets using .NET
AutoFixture/AutoFixture
AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability. Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.
hirschmann/nbfc
NoteBook FanControl
dotnet/sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
aaubry/YamlDotNet
YamlDotNet is a .NET library for YAML
Squidex/squidex
Headless CMS and Content Managment Hub
ButchersBoy/Dragablz
Dragable and tearable tab control for WPF
BrighterCommand/Brighter
A framework for building messaging apps with .NET and C#.
dotnetcore/Magicodes.IE
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
dotnetcore/EasyCaching
:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
EPPlusSoftware/EPPlus
EPPlus-Excel spreadsheets for .NET
dotnet/templating
This repo contains the Template Engine which is used by dotnet new
nhibernate/fluent-nhibernate
Fluent NHibernate!
microsoft/PowerApps-Samples
Sample code for Power Apps, including Dataverse, model-driven apps, canvas apps, Power Apps component framework, portals, and AI Builder.
NEventStore/NEventStore
A persistence agnostic Event Store for .NET
Version Downloads Last updated
8.3.0 3,683,087 10 months ago
8.2.0 1,255,239 4/10/2024
8.1.0 1,787,416 1/5/2024
8.0.1 112,633 12/26/2023
8.0.0 731,885 11/7/2023
7.4.0 3,083,368 4/23/2023
7.3.1 7,331,010 3/8/2022
7.3.0 1,292,621 1/17/2022
7.2.0 2,295,180 9/1/2021
7.1.0 1,304,070 6/7/2021
7.0.2 501,815 5/4/2021
7.0.1 571,258 3/30/2021
7.0.0 347,077 3/15/2021
6.2.1 3,681,303 9/2/2020
6.2.0 652,443 7/23/2020
6.1.0 1,216,294 6/8/2020
6.0.1 903,464 4/10/2020
6.0.0 3,013,831 1/17/2020
5.5.0 1,866,994 11/25/2019
5.4.1 139,931 11/14/2019
5.4.0 326,909 10/23/2019
5.3.0 95,944 10/16/2019
5.2.0 686,509 9/5/2019
5.1.2 135,220 8/30/2019
5.1.1 1,742,946 4/15/2019
5.1.0 1,113,143 2/11/2019
5.0.1 278,027 1/14/2019
5.0.0 112,013 1/7/2019
4.9.2 274,286 12/13/2018
4.9.1 1,070,403 9/28/2018
4.9.0 1,058,852 9/27/2018
4.8.1 256,465 9/4/2018
4.8.0 281,304 8/8/2018
4.7.1 777,901 7/6/2018
4.7.0 28,863 7/3/2018
4.6.0 1,034,530 5/14/2018
4.5.1 689,387 2/28/2018
4.5.0 159,044 2/19/2018
4.4.0 137,633 2/6/2018
4.3.0 298,591 12/6/2017
4.2.0 240,635 11/8/2017
4.1.1 77,473 10/18/2017
4.1.0 100,683 10/10/2017
4.0.0 537,502 7/27/2017
3.4.2 233,716 6/19/2017
3.4.1 332,438 6/15/2017
3.3.2 198,719 5/4/2017
3.3.1 4,851 5/4/2017
3.3.0 6,322 5/4/2017
3.2.0 1,262,166 4/5/2017
3.1.0 97,808 3/10/2017
3.0.0 140,156 2/22/2017
2.3.3 206,651 1/18/2017
2.3.2 90,878 12/14/2016
2.3.1 332,585 9/30/2016
2.3.0 27,916 9/26/2016
2.2.0 205,280 7/14/2016
2.1.0 121,233 6/20/2016
2.0.0 214,735 5/25/2016
1.25.3 841,058 7/24/2015
1.24.0 103,294 8/25/2014
1.23.0 14,846 8/7/2014
1.22.0 60,271 6/17/2014
1.21.0 28,016 5/28/2014
1.20.0 14,267 5/6/2014
1.19.0 22,053 4/15/2014
1.18.0 104,801 3/5/2014
1.17.0 103,947 1/14/2014
1.16.0 6,141 1/9/2014
1.15.0 14,764 12/11/2013
1.14.0 32,367 10/24/2013
1.13.1 41,420 7/30/2013
1.12.0 19,990 5/27/2013
1.11.0 10,844 5/6/2013
1.10.0 12,826 3/28/2013
1.9.1 15,987 3/6/2013
1.8.0 42,345 2/12/2013
1.7.4626.65 36,298 8/31/2012
1.7.4582.63 11,223 7/18/2012
1.7.4574.62 5,124 7/10/2012
1.7.4507.61 12,196 5/4/2012
1.7.4257.42 23,479 8/28/2011
1.7.4166.27 13,448 5/29/2011
1.7.4117.2 6,722 4/10/2011
1.7.4109.1 331,261 4/2/2011
1.6.4075.221 9,667 3/1/2011
1.6.4062.205 7,274 2/14/2011
1.5.3970.199 7,949 1/7/2011
1.0.0.5 38,263 1/7/2011