CreateAndFake 1.11.0
dotnet add package CreateAndFake --version 1.11.0
NuGet\Install-Package CreateAndFake -Version 1.11.0
<PackageReference Include="CreateAndFake" Version="1.11.0" />
paket add CreateAndFake --version 1.11.0
#r "nuget: CreateAndFake, 1.11.0"
// 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 | Versions 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. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- System.Reflection.Emit (>= 4.7.0)
- System.ValueTuple (>= 4.5.0)
-
net8.0
- No dependencies.
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 | 129 | 9/16/2024 |
1.10.5 | 105 | 9/11/2024 |
1.10.4 | 143 | 8/22/2024 |
1.10.3 | 122 | 8/21/2024 |
1.10.2 | 132 | 1/31/2024 |
1.10.1 | 109 | 1/31/2024 |
1.10.0 | 128 | 1/16/2024 |
1.9.14 | 711 | 8/26/2021 |
1.9.13 | 421 | 8/26/2021 |
1.9.12 | 345 | 8/6/2021 |
1.9.11 | 756 | 6/21/2021 |
1.9.10 | 438 | 5/2/2021 |
1.9.9 | 532 | 4/10/2021 |
1.9.8 | 429 | 3/13/2021 |
1.9.7 | 370 | 3/2/2021 |
1.9.6 | 337 | 3/1/2021 |
1.9.5 | 356 | 2/20/2021 |
1.9.4 | 375 | 2/19/2021 |
1.9.3 | 363 | 2/17/2021 |
1.9.2 | 353 | 2/13/2021 |
1.9.1 | 390 | 2/7/2021 |
1.9.0 | 370 | 2/4/2021 |
1.8.4 | 510 | 1/29/2021 |
1.8.3 | 390 | 1/27/2021 |
1.8.2 | 849 | 12/16/2019 |
1.8.1 | 540 | 12/9/2019 |
1.8.0 | 531 | 11/18/2019 |
1.7.6 | 526 | 10/23/2019 |
1.7.5 | 538 | 10/18/2019 |
1.7.4 | 573 | 10/15/2019 |
1.7.3 | 515 | 10/7/2019 |
1.7.2 | 536 | 10/1/2019 |
1.7.1 | 529 | 9/25/2019 |
1.7.0 | 549 | 9/20/2019 |
1.6.5 | 1,665 | 7/16/2018 |
1.6.4 | 1,131 | 7/9/2018 |
1.6.3 | 1,143 | 6/27/2018 |
1.6.2 | 1,157 | 6/25/2018 |
1.6.1 | 1,158 | 6/20/2018 |
1.6.0 | 1,135 | 6/7/2018 |
1.5.1 | 1,137 | 6/7/2018 |
1.5.0 | 1,114 | 6/4/2018 |
1.4.1 | 1,308 | 5/20/2018 |
1.4.0 | 1,350 | 5/15/2018 |