SqlTestPrep 1.0.3

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

// Install SqlTestPrep as a Cake Tool
#tool nuget:?package=SqlTestPrep&version=1.0.3                

SQLTestPrep is designed to work with unit testing frameworks to test data access classes. Working with a clean database SQLTestPrep inserts a set of data into a database before your test and then deleting the data after the test. If you configure your unit test to run the SQLTestPrep before and after each test, each of your unit tests has a clean set of known data to manipulate.

Setup is simple.

  1. Add a folder called "SqlConfiguration" to your unit test project. This folder will contain your .sql files for inserting and deleting data from the database.
  2. Add your .sql files to the SqlConfiguration folder
  3. Add configuration file named "SqlConfiguration.json" to the root of your unit test project
  4. Setup the configuration

[ { "SqlConfigurationName": "", "ConnectionString": "", "SqlConfigurationJobs": [ { "BeforeTestSqlFile": "", "AfterTestSqlFile": "", "SortOrder": "" }, { "BeforeTestSqlFile": "", "AfterTestSqlFile": "", "SortOrder": "" } ] } ]

EXAMPLE

[ { "SqlConfigurationName": "PersonTest", "ConnectionString": "Server=.;Database=Contact;User Id=contactuser;Password=password;", "SqlConfigurationJobs": [ { "BeforeTestSqlFile": "C:\repos\SqlTestPrep\SqlTestPrep.ScratchTests\SqlConfiguration\PersonTest_Setup.sql", "AfterTestSqlFile": "C:\repos\SqlTestPrep\SqlTestPrep.ScratchTests\SqlConfiguration\PersonTest_Teardown.sql", "SortOrder": "0" }, { "BeforeTestSqlFile": "C:\repos\SqlTestPrep\SqlTestPrep.ScratchTests\SqlConfiguration\PersonTest_States_Setup.sql", "AfterTestSqlFile": "C:\repos\SqlTestPrep\SqlTestPrep.ScratchTests\SqlConfiguration\PersonTest_States_Teardown.sql", "SortOrder": "1" } ] } ]

  1. In your unit test create an instance of the SqlTestPrep.SqlLoader classes
  2. Before each test call sqlLoader.Setup("<<SqlConfigurationName>>")
  3. After each test call sqlLoader.Teardown("<<SqlConfigurationName>>")

For Example

//Instantiate SqlLoader var sqlLoader = new SqlLoader();

//Call Setup before the test sqlLoader.Setup("PersonTest");

//Call Teardown before the test sqlLoader.Teardown("PersonTest");

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 was computed.  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 netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework 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 tizen30 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 1,467 10/10/2017
1.0.1 1,057 7/10/2017
0.1.0 1,040 7/10/2017

Moved config file path to appSettings.json file