StrangerData 101.0.1
dotnet add package StrangerData --version 101.0.1
NuGet\Install-Package StrangerData -Version 101.0.1
<PackageReference Include="StrangerData" Version="101.0.1" />
<PackageVersion Include="StrangerData" Version="101.0.1" />
<PackageReference Include="StrangerData" />
paket add StrangerData --version 101.0.1
#r "nuget: StrangerData, 101.0.1"
#:package StrangerData@101.0.1
#addin nuget:?package=StrangerData&version=101.0.1
#tool nuget:?package=StrangerData&version=101.0.1
StrangerData - A .NET database populator for testing purposes
Project Description
StrangerData is a tool designed to automatically fills your database with random data to make your unit/integration tests faster.
The generator will auto maps all foreign keys and generates records to related tables.
Getting Started
- Install StrangerData with NuGet Package Manager:
Install-Package StrangerData
- Install your database dialect, example:
Install-Package StrangerData.SqlServer
- Configure the required connection strings.
To start generating your test data, create a new DataFactory object:
using StrangerData;
using StrangerData.SqlServer;
...
var dataFactory = new DataFactory<SqlServerDialect>("MyConnectionString");
Usage
Consider the example schema:
Person Table
| Column | Data Type | PK | FK |
|---|---|---|---|
| Id | INT | True | False |
| Name | VARCHAR(20) | False | False |
| VARCHAR(50) | False | False | |
| Age | INT | False | False |
| TeamId | INT | False | Team(Id) |
Team Table
| Column | Data Type | PK | FK |
|---|---|---|---|
| Id | INT | True | False |
| Name | VARCHAR(20) | False | False |
1. Creates a single record:
...
IDicionary<string, object> record = dataFactory.CreateOne("dbo.Person");
The method will creates an record in the group table, and associates it to the created user. The dictionary will contains:
{
"Id": "Generated User's Id",
"Name": "Random string",
"Email": "Random string",
"Age": "Random integer number",
"TeamId": "Id from generated group record"
}
So you can specify your custom values. Do following:
User user = dataFactory.CreateOne("dbo.Person", t => {
t.WithValue("Name", "Will Byers");
});
The dictionary will contains:
{
"Id": "Generated User's Id",
"Name": "Will Byers",
"Email": "Random string",
"Age": "Random integer number",
"TeamId": "Id from generated group record"
}
2. Delete generated records:
To delete all generated records, just run:
...
dataFactory.TearDown();
...
We suggest to use the TearDown() method inside yor Finally scope. This way it will run even if you code crashes on running, avoiding to have dirty data on your database.
| 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. 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. |
| .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 | net452 is compatible. net46 was computed. 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. |
-
.NETFramework 4.5.2
- No dependencies.
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on StrangerData:
| Package | Downloads |
|---|---|
|
StrangerData.SqlServer
MS SQL Server Dialect for StrangerData data generator. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 101.0.1 | 16,700 | 12/6/2024 |
| 101.0.0 | 5,449 | 2/8/2024 |
| 100.0.1 | 37,503 | 3/23/2021 |
| 100.0.0 | 935 | 3/19/2021 |
| 99.99.99 | 26,306 | 10/31/2017 |
| 1.0.64 | 3,601 | 5/27/2017 |
| 1.0.63 | 1,620 | 3/8/2017 |
| 1.0.62 | 1,682 | 2/17/2017 |
| 1.0.45 | 1,312 | 1/9/2017 |
| 1.0.42 | 1,279 | 1/9/2017 |
| 1.0.39 | 1,614 | 10/13/2016 |
| 1.0.37 | 2,405 | 10/13/2016 |
| 1.0.35 | 1,524 | 10/7/2016 |
| 0.0.5 | 1,610 | 9/20/2016 |
| 0.0.4 | 1,620 | 8/25/2016 |
| 0.0.3 | 2,239 | 8/1/2016 |
| 0.0.2 | 2,147 | 7/26/2016 |