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 79 9/16/2024
1.10.5 68 9/11/2024
1.10.4 113 8/22/2024
1.10.3 87 8/21/2024
1.10.2 111 1/31/2024
1.10.1 91 1/31/2024
1.10.0 110 1/16/2024
1.9.14 684 8/26/2021
1.9.13 390 8/26/2021
1.9.12 324 8/6/2021
1.9.11 736 6/21/2021
1.9.10 411 5/2/2021
1.9.9 509 4/10/2021
1.9.8 405 3/13/2021
1.9.7 351 3/2/2021
1.9.6 328 3/1/2021
1.9.5 332 2/20/2021
1.9.4 356 2/19/2021
1.9.3 354 2/17/2021
1.9.2 332 2/13/2021
1.9.1 371 2/7/2021
1.9.0 343 2/4/2021
1.8.4 483 1/29/2021
1.8.3 371 1/27/2021
1.8.2 824 12/16/2019
1.8.1 516 12/9/2019
1.8.0 512 11/18/2019
1.7.6 501 10/23/2019
1.7.5 516 10/18/2019
1.7.4 549 10/15/2019
1.7.3 492 10/7/2019
1.7.2 517 10/1/2019
1.7.1 510 9/25/2019
1.7.0 524 9/20/2019
1.6.5 1,635 7/16/2018
1.6.4 1,102 7/9/2018
1.6.3 1,115 6/27/2018
1.6.2 1,126 6/25/2018
1.6.1 1,130 6/20/2018
1.6.0 1,104 6/7/2018
1.5.1 1,111 6/7/2018
1.5.0 1,081 6/4/2018
1.4.1 1,281 5/20/2018
1.4.0 1,317 5/15/2018