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 120 9/16/2024
1.10.5 97 9/11/2024
1.10.4 135 8/22/2024
1.10.3 114 8/21/2024
1.10.2 128 1/31/2024
1.10.1 105 1/31/2024
1.10.0 124 1/16/2024
1.9.14 704 8/26/2021
1.9.13 415 8/26/2021
1.9.12 339 8/6/2021
1.9.11 749 6/21/2021
1.9.10 431 5/2/2021
1.9.9 526 4/10/2021
1.9.8 423 3/13/2021
1.9.7 364 3/2/2021
1.9.6 331 3/1/2021
1.9.5 350 2/20/2021
1.9.4 369 2/19/2021
1.9.3 357 2/17/2021
1.9.2 347 2/13/2021
1.9.1 384 2/7/2021
1.9.0 364 2/4/2021
1.8.4 502 1/29/2021
1.8.3 384 1/27/2021
1.8.2 843 12/16/2019
1.8.1 534 12/9/2019
1.8.0 525 11/18/2019
1.7.6 520 10/23/2019
1.7.5 532 10/18/2019
1.7.4 567 10/15/2019
1.7.3 509 10/7/2019
1.7.2 530 10/1/2019
1.7.1 523 9/25/2019
1.7.0 542 9/20/2019
1.6.5 1,655 7/16/2018
1.6.4 1,120 7/9/2018
1.6.3 1,133 6/27/2018
1.6.2 1,146 6/25/2018
1.6.1 1,148 6/20/2018
1.6.0 1,124 6/7/2018
1.5.1 1,126 6/7/2018
1.5.0 1,103 6/4/2018
1.4.1 1,296 5/20/2018
1.4.0 1,337 5/15/2018