Bambit.TestUtility.DataGeneration
1.5.2
Prefix Reserved
dotnet add package Bambit.TestUtility.DataGeneration --version 1.5.2
NuGet\Install-Package Bambit.TestUtility.DataGeneration -Version 1.5.2
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="Bambit.TestUtility.DataGeneration" Version="1.5.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bambit.TestUtility.DataGeneration" Version="1.5.2" />
<PackageReference Include="Bambit.TestUtility.DataGeneration" />
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 Bambit.TestUtility.DataGeneration --version 1.5.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bambit.TestUtility.DataGeneration, 1.5.2"
#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 Bambit.TestUtility.DataGeneration@1.5.2
#: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=Bambit.TestUtility.DataGeneration&version=1.5.2
#tool nuget:?package=Bambit.TestUtility.DataGeneration&version=1.5.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bambit.TestUtility.DataGeneration
Provides methods to automatically generated random data and populate objects.
Getting started
Install:
PM> Install-Package Bambit.TestUtility.DataGeneration
Usage
The class RandomDataGenerator
provides a static instance that can be used for all calls.
All implemenation methods of IRandomDataGenerator
are implemented as virtual
to allow for extending the functionality.
Generating Basic Types
// Generate string with 10 characters
string string10Characters = RandomDataGenerator.Instance.GenerateString(10);
// Generate string with 20 characters
string string10Characters = RandomDataGenerator.Instance.GenerateString(20);
// Generate an int between 1 and 100
int randomInt = RandomDataGenerator.Instance.GenerateString(0,100);
// Generate a first name
string firstName = RandomDataGenerator.Instance.GenerateFirstName();
For more types that can be generated, see IRandomDataGenerator
Instaniating Objects
// Populate properties on existing object
TestClass testClass=new();
RandomDataGenerator.Instance.InitializeObject(testClass);
// Create new object and initialize properties
TestClass testClass= RandomDataGenerator.Instance.InitializeObject<TestClass>();
// Call method after initializing an object
Person testClass= RandomDataGenerator.Instance.InitializeObject<Person>((generatedObject)=>{
generatedObject.FirstName = "Freddy";
generatedObject.LastName = "Kruger"
});
// Initialize a colleciton of objets, this creates a list of 4 new objects
IList<Person> initializeList = RandomDataGenerator.Instance.InitializeList<Person>(4);
Additional documentation
Coming Soon!
Feedback
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
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bambit.TestUtility.DataGeneration:
Package | Downloads |
---|---|
Bambit.TestUtility.DatabaseTools
Provides tools for dynamically instantiating classes based on Database tables . |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.5.2 | 312 | 2/19/2025 |
1.5.1 | 156 | 2/18/2025 |
1.5.0 | 165 | 2/18/2025 |
1.4.4 | 296 | 1/8/2025 |
1.4.1 | 150 | 12/10/2024 |
1.4.0 | 134 | 12/10/2024 |
1.3.5 | 156 | 12/3/2024 |
1.3.3 | 146 | 11/26/2024 |
1.3.2 | 145 | 11/26/2024 |
1.3.1 | 141 | 11/26/2024 |
1.3.0 | 148 | 11/26/2024 |
1.2.4 | 148 | 11/18/2024 |
1.2.1 | 260 | 8/20/2024 |
1.2.0 | 160 | 8/19/2024 |
1.1.0 | 131 | 7/30/2024 |
1.0.2-alpha.0.22 | 66 | 7/30/2024 |
1.0.2-alpha.0.16 | 58 | 7/29/2024 |
1.0.1 | 158 | 7/2/2024 |
1.0.0 | 135 | 7/1/2024 |
0.0.0-alpha.0.14 | 73 | 7/2/2024 |