CreateAndFake 1.10.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package CreateAndFake --version 1.10.5                
NuGet\Install-Package CreateAndFake -Version 1.10.5                
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="CreateAndFake" Version="1.10.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CreateAndFake --version 1.10.5                
#r "nuget: CreateAndFake, 1.10.5"                
#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 CreateAndFake as a Cake Addin
#addin nuget:?package=CreateAndFake&version=1.10.5

// Install CreateAndFake as a Cake Tool
#tool nuget:?package=CreateAndFake&version=1.10.5                

A C# class library that handles mocking, test data generation, and validation. Designed to handle the bulk of test setup quickly and easily so that developers can focus on the behavior to test, making tests easier to develop and maintain:

// xUnit attributes used to automatically create the parameters.
[Theory, RandomData]
internal static void TestGetMovieDirectors(
    [Fake] IStorage db, Endpoint api, [Size(2)] Details[] movies)
{
    // Setup fake behavior using randomized movie data (times optional).
    db.Find(movies[0].Name).SetupReturn(movies, Times.Once);

    // Call code and test for expected result (api is auto-injected with db fake).
    api.GetDirectors(movies[0].Name, movies[0].Year).Assert().Is(movies[0].Directors);

    // Optionally check all behavior called as expected.
    db.VerifyAllCalls();
}

By default, all behavior works not by reference but by value even for complex objects. Using the extension methods and attributes are optional as all functionality are present in customizable tools:

[Fact]
internal static void TestChangingZipCodeUpdatesAddress()
{
    // Randomizer uses readable values for some properties like 'FirstName'.
    User details = Tools.Randomizer.Create<User>();

    // Duplicator creates deep clones. 
    User copy = Tools.Duplicator.Copy(details);

    // Mutator can randomly modify objects too.
    details.ZipCode = Tools.Mutator.Variant(details.ZipCode);

    // Asserter performs checks based upon value.
    Tools.Asserter.IsNot(copy.MailingAddress, details.MailingAddress);
}

A key benefit of the library is in how the tools are logically integrated with each other. For example, the Randomizer will use stubs for interfaces that have no known implementations in the code. Or the mocks created by the Faker utilize value equality in matching arguments.

  • Asserter - Handles common test scenarios.
  • Faker - Creates mocks and stubs.
  • Randomizer - Creates random instances of any type.
  • Duplicator - Creates deep clones of objects.
  • Mutator - Mutates objects or creates variants.
  • Valuer - Compares objects by value.
  • Tester - Automates common tests.

Visit the documentation site for more information and how to get started.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.11.0 122 9/16/2024
1.10.5 99 9/11/2024
1.10.4 137 8/22/2024
1.10.3 116 8/21/2024
1.10.2 130 1/31/2024
1.10.1 107 1/31/2024
1.10.0 126 1/16/2024
1.9.14 706 8/26/2021
1.9.13 417 8/26/2021
1.9.12 341 8/6/2021
1.9.11 751 6/21/2021
1.9.10 433 5/2/2021
1.9.9 528 4/10/2021
1.9.8 425 3/13/2021
1.9.7 366 3/2/2021
1.9.6 333 3/1/2021
1.9.5 352 2/20/2021
1.9.4 371 2/19/2021
1.9.3 359 2/17/2021
1.9.2 349 2/13/2021
1.9.1 386 2/7/2021
1.9.0 366 2/4/2021
1.8.4 504 1/29/2021
1.8.3 386 1/27/2021
1.8.2 845 12/16/2019
1.8.1 536 12/9/2019
1.8.0 527 11/18/2019
1.7.6 522 10/23/2019
1.7.5 534 10/18/2019
1.7.4 569 10/15/2019
1.7.3 511 10/7/2019
1.7.2 532 10/1/2019
1.7.1 525 9/25/2019
1.7.0 544 9/20/2019
1.6.5 1,657 7/16/2018
1.6.4 1,122 7/9/2018
1.6.3 1,135 6/27/2018
1.6.2 1,148 6/25/2018
1.6.1 1,150 6/20/2018
1.6.0 1,126 6/7/2018
1.5.1 1,128 6/7/2018
1.5.0 1,105 6/4/2018
1.4.1 1,298 5/20/2018
1.4.0 1,339 5/15/2018