CaveTester.Bogus 1.0.0-beta1

Package Description

This is a prerelease version of CaveTester.Bogus.
There is a newer prerelease version of this package available.
See the version list below for details.
Install-Package CaveTester.Bogus -Version 1.0.0-beta1
dotnet add package CaveTester.Bogus --version 1.0.0-beta1
<PackageReference Include="CaveTester.Bogus" Version="1.0.0-beta1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CaveTester.Bogus --version 1.0.0-beta1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CaveTester.Bogus, 1.0.0-beta1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CaveTester.Bogus as a Cake Addin
#addin nuget:?package=CaveTester.Bogus&version=1.0.0-beta1&prerelease

// Install CaveTester.Bogus as a Cake Tool
#tool nuget:?package=CaveTester.Bogus&version=1.0.0-beta1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Cave Tester

Cave Tester is a lightweight testing library that help you manage your database and generate mock data.

Features

  • Automatic database save and restore
  • Determinist id generator
  • Rules sets for object generation with Bogus

Planned features

  • Database pooling for easier parallel testing
  • Some methods to test entity ⇔ dto mapping

Quickstart

public class FooTests : Tester
{
	private readonly DbContext _dbContext;

	public FooTests()
	{
		// init your context here

		// Create a snapshot of the database before the test begin
		SaveHandler.Add(new SqlServerDbSnapshot(_dbContext.Database));
	}

	[Fact]
	public async Task ShouldFoo()
	{
		// Generate 5 Person with a random name
		await _dbContext.Generate<Person>(5, (faker, person) => person.Name = faker.Lorem.Word())
				 .SaveChangesAsync();

		// method to test
		// assertions

		// The database will automaticly be restored in a clean state from the snapeshot, wich will then be deleted
		// This happen even if the test fails
	}
}

public class Person
{
	public string Name { get; set; }
}

Example

See a complete example here

Cave Tester

Cave Tester is a lightweight testing library that help you manage your database and generate mock data.

Features

  • Automatic database save and restore
  • Determinist id generator
  • Rules sets for object generation with Bogus

Planned features

  • Database pooling for easier parallel testing
  • Some methods to test entity ⇔ dto mapping

Quickstart

public class FooTests : Tester
{
	private readonly DbContext _dbContext;

	public FooTests()
	{
		// init your context here

		// Create a snapshot of the database before the test begin
		SaveHandler.Add(new SqlServerDbSnapshot(_dbContext.Database));
	}

	[Fact]
	public async Task ShouldFoo()
	{
		// Generate 5 Person with a random name
		await _dbContext.Generate<Person>(5, (faker, person) => person.Name = faker.Lorem.Word())
				 .SaveChangesAsync();

		// method to test
		// assertions

		// The database will automaticly be restored in a clean state from the snapeshot, wich will then be deleted
		// This happen even if the test fails
	}
}

public class Person
{
	public string Name { get; set; }
}

Example

See a complete example here

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0-beta2 390 11/30/2018
1.0.0-beta1 354 9/26/2018