CreateAndFake 1.11.0

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

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

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 117 9/16/2024
1.10.5 96 9/11/2024
1.10.4 134 8/22/2024
1.10.3 113 8/21/2024
1.10.2 127 1/31/2024
1.10.1 102 1/31/2024
1.10.0 123 1/16/2024
1.9.14 701 8/26/2021
1.9.13 410 8/26/2021
1.9.12 338 8/6/2021
1.9.11 748 6/21/2021
1.9.10 430 5/2/2021
1.9.9 525 4/10/2021
1.9.8 422 3/13/2021
1.9.7 363 3/2/2021
1.9.6 330 3/1/2021
1.9.5 349 2/20/2021
1.9.4 368 2/19/2021
1.9.3 356 2/17/2021
1.9.2 344 2/13/2021
1.9.1 383 2/7/2021
1.9.0 363 2/4/2021
1.8.4 501 1/29/2021
1.8.3 383 1/27/2021
1.8.2 842 12/16/2019
1.8.1 533 12/9/2019
1.8.0 524 11/18/2019
1.7.6 519 10/23/2019
1.7.5 531 10/18/2019
1.7.4 566 10/15/2019
1.7.3 508 10/7/2019
1.7.2 529 10/1/2019
1.7.1 522 9/25/2019
1.7.0 541 9/20/2019
1.6.5 1,652 7/16/2018
1.6.4 1,119 7/9/2018
1.6.3 1,132 6/27/2018
1.6.2 1,145 6/25/2018
1.6.1 1,147 6/20/2018
1.6.0 1,123 6/7/2018
1.5.1 1,125 6/7/2018
1.5.0 1,102 6/4/2018
1.4.1 1,295 5/20/2018
1.4.0 1,336 5/15/2018