MockForge 2.3.3
dotnet add package MockForge --version 2.3.3
NuGet\Install-Package MockForge -Version 2.3.3
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="MockForge" Version="2.3.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MockForge" Version="2.3.3" />
<PackageReference Include="MockForge" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MockForge --version 2.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MockForge, 2.3.3"
#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.
#:package MockForge@2.3.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MockForge&version=2.3.3
#tool nuget:?package=MockForge&version=2.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MockForge
A lightweight .NET8 library to generate fake data (mock) with zero configuration.
Providers
AnswerProviderMagic8Ball()YesNo()TrueFalse()
IdentityProviderGender()WeightedGender()Species()GetRobotName(string input, int number, bool keepSeparator)MaleFirstName(),FemaleFirstName(),LastName()MaleTitle(),FemaleTitle()MaleNobleTitle(),FemaleNobleTitle()City()Person(...)and helpers:MalePerson(...)FemalePerson(...)AndroidPerson(...)ExtraterrestrialPerson(...)OtherGenderPerson(...)
ColorProviderGetHexColor(string input)GetRgbColor(string input)GetRgbaColor(string input, double alpha = 1.0)GetColorName()
DateProviderFutureDateTime(int maxYearsInFuture = 10)PastDateTime(int maxYearsInPast = 50)FutureDate(int maxYearsInFuture = 10)PastDate(int maxYearsInPast = 50)RandomTime()RandomDateTime(int maxYearsPast = 50, int maxYearsFuture = 10)RandomDate(int maxYearsPast = 50, int maxYearsFuture = 10)RandomDateTimeByAgeRange(int minAge = 18, int? maxAge = 120)RandomDateByAgeRange(int minAge = 18, int? maxAge = 120)
NumberProviderRandomDecimal(decimal? min = 0, decimal? max = 1, int? decimals = 2)RandomNumber<T>(T? min = default, T? max = default) where T : struct, IComparable<T>, IConvertibleRandomPaddedNumber(int length, int maxInclusive)
CardProviderPokerCardRank(),PokerCardSuit(),PokerCard()SpanishCardRank(),SpanishCardSuit(),SpanishCard()UnoColor(),UnoNumberCard(),UnoActionCard(),UnoWildCard(),UnoCard()TarotMajorArcana(),TarotArcanoMayor()
ProfessionProviderCompany(),CompanyDepartment()StateEmployeeDepartment(),StateEmployeeRank()PoliceDepartment(),PoliceRank()Profession()� returns aProfessionmodelPoliceEmployee(),PublicStateEmployee()
FoodProviderAny(),Fruit(),Vegetable(),Grain(),Protein(),Dairy(),Legume(),NutOrSeed()
AnimalProviderAny(),Real(),Mythical()
PlantProviderAny(),Flower(),HousePlant(),Tree(),Herb(),Shrub()
HousingProviderGenerate(int minFloor, int maxFloor)� returnsApartmentDefinition
ImageProviderGenerateRandomBitmap(int width, int height, int tileSize = 32)GeneratePngRGBNative(int width, int height, int tileSize = 32, int delta = 30)GeneratePngHSVNative(int width, int height, int tileSize = 32, float maxHueStep = 15f)GenerateAvatarPng(string seed, int logicalSize = 8, int scale = 8)
ProgressionProviderFibonacci(int n),Jacobsthal(int n),Lucas(int n),Pell(int n),HofstadterQ(int n),Exotic(int n)LogisticMap(int n, double r = 4.0, double x0 = 0.2)- Random variants:
RandomFibonacci(...)RandomJacobsthal(...)RandomLucas(...)RandomPell(...)RandomHofstadterQ(...)RandomLogisticMap(...)RandomExotic(...)RandomProgression(...)
GetProgressionName(int progressionType)ClearCache(),ClearCache(string progressionName)
EnumProviderGetRandomValue<T>() where T : struct, EnumIsValid<T>(string? value) where T : struct, Enum
ArrayProviderPick<T>(T[]? array)
Quick start
Example without DI
using System;
using MockForge;
using MockForge.Providers;
var forge = MockForgeFactory.Create();
var answer = forge.Get<AnswerProvider>().Magic8Ball();
Console.WriteLine($"Magic8 Ball: {answer}");
Example with DI
using System;
using Microsoft.Extensions.DependencyInjection;
using MockForge;
using MockForge.Providers;
var services = new ServiceCollection();
// Register the provider using the factory. Alternatively, register the full "forge" instance.
services.AddSingleton(sp => MockForgeFactory.Create().Get<AnswerProvider>());
var provider = services.BuildServiceProvider().GetRequiredService<AnswerProvider>();
Console.WriteLine(provider.Magic8Ball());
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of MockForge (v1.0.0): locale-aware fake data, deterministic seed support, and DI-friendly providers.