StrangerData 101.0.1

dotnet add package StrangerData --version 101.0.1                
NuGet\Install-Package StrangerData -Version 101.0.1                
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="StrangerData" Version="101.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StrangerData --version 101.0.1                
#r "nuget: StrangerData, 101.0.1"                
#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 StrangerData as a Cake Addin
#addin nuget:?package=StrangerData&version=101.0.1

// Install StrangerData as a Cake Tool
#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

  1. Install StrangerData with NuGet Package Manager:

Install-Package StrangerData

  1. Install your database dialect, example:

Install-Package StrangerData.SqlServer

  1. 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
Email 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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 42 12/6/2024
101.0.0 3,807 2/8/2024
100.0.1 28,585 3/23/2021
100.0.0 782 3/19/2021
99.99.99 22,415 10/31/2017
1.0.64 3,166 5/27/2017
1.0.63 1,299 3/8/2017
1.0.62 1,348 2/17/2017
1.0.45 1,011 1/9/2017
1.0.42 974 1/9/2017
1.0.39 1,304 10/13/2016
1.0.37 2,055 10/13/2016
1.0.35 1,236 10/7/2016
0.0.5 1,323 9/20/2016
0.0.4 1,306 8/25/2016
0.0.3 1,923 8/1/2016
0.0.2 1,813 7/26/2016