SqlTestPrep 1.0.1
See the version list below for details.
dotnet add package SqlTestPrep --version 1.0.1
NuGet\Install-Package SqlTestPrep -Version 1.0.1
<PackageReference Include="SqlTestPrep" Version="1.0.1" />
paket add SqlTestPrep --version 1.0.1
#r "nuget: SqlTestPrep, 1.0.1"
// Install SqlTestPrep as a Cake Addin #addin nuget:?package=SqlTestPrep&version=1.0.1 // Install SqlTestPrep as a Cake Tool #tool nuget:?package=SqlTestPrep&version=1.0.1
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.
- 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.
- Add your .sql files to the SqlConfiguration folder
- Add configuration file named "SqlConfiguration.json" to the root of your unit test project
- 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" } ] } ]
- In your unit test create an instance of the SqlTestPrep.SqlLoader classes
- Before each test call sqlLoader.Setup("<<SqlConfigurationName>>")
- 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 | 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 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. |
-
.NETStandard 1.6
- Microsoft.Extensions.Configuration.Json (>= 1.1.2)
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 10.0.3)
- System.Data.SqlClient (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Moved config file path to appSettings.json file