From 30a0b6b1d64a520222a0971181700ab1e982e67f Mon Sep 17 00:00:00 2001 From: Bradley Grainger Date: Thu, 19 Oct 2023 17:39:56 -0700 Subject: [PATCH] Add package README. --- .../AdoNet.Specification.Tests.csproj | 5 +++ src/AdoNet.Specification.Tests/README.md | 43 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/AdoNet.Specification.Tests/README.md diff --git a/src/AdoNet.Specification.Tests/AdoNet.Specification.Tests.csproj b/src/AdoNet.Specification.Tests/AdoNet.Specification.Tests.csproj index fc1cac3..c950fbe 100644 --- a/src/AdoNet.Specification.Tests/AdoNet.Specification.Tests.csproj +++ b/src/AdoNet.Specification.Tests/AdoNet.Specification.Tests.csproj @@ -13,6 +13,7 @@ Bradley Grainger netstandard2.0;netstandard2.1 true + README.md ado.net;database;test https://github.com/mysql-net/AdoNetApiTest/blob/master/VersionHistory.md https://mysql-net.github.io/AdoNetResults/ @@ -38,4 +39,8 @@ + + + + diff --git a/src/AdoNet.Specification.Tests/README.md b/src/AdoNet.Specification.Tests/README.md new file mode 100644 index 0000000..a138ffa --- /dev/null +++ b/src/AdoNet.Specification.Tests/README.md @@ -0,0 +1,43 @@ +## ADO.NET Specification Tests + +This package provides base classes that let you test your ADO.NET library for conformance to common ADO.NET patterns. +ADO.NET doesn't have a formal specification for ADO.NET providers, but many libraries (such as +[Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient), +[Npgsql](https://www.nuget.org/packages/Npgsql), and [MySqlConnector](https://www.nuget.org/packages/MySqlConnector)) +exhibit similar behavior. + +### Usage + +Create a test project that uses [xunit](https://www.nuget.org/packages/xunit). + +Write a class that implements `IDbFactoryFixture`: + +```csharp +public class DbFactoryFixture : IDbFactoryFixture +{ + public DbFactoryFixture() + { + ConnectionString ="your test connection string"; + } + + public string ConnectionString { get; } + public DbProviderFactory Factory => YourDbProviderFactory.Instance; +} +``` + +Then write test classes that inherit from the classes in this package, e.g., + +```csharp +public sealed class ConnectionTests : ConnectionTestBase +{ + public ConnectionTests(DbFactoryFixture fixture) + : base(fixture) + { + } + + [Fact(Skip = "Override a method and provide a 'Skip' reason to opt out of a test.")] + public override void Set_ConnectionString_throws_when_invalid() + { + } +} +```