This library provides a suit of xUnit.net-based tests for ADO.NET providers, i.e.,
classes that inherit from DbConnection
, DbCommand
, DbDataReader
, etc.
It intends to clarify ambiguous areas in the ADO.NET documentation and help ensure that various providers act consistently (when the behaviour doesn't depend on the specific target database server).
The results from the latest build are published here.
Add a reference to the NuGet package to your test project.
Create a class that implements IDbFactoryFixture
: the
Factory
property must return a DbProviderFactory
for your ADO.NET implementation,
and the ConnectionString
property must return a valid connection string that the test
suite can use to connect to a database. See
this example for
System.Data.SqlClient
.
To use the tests that execute SQL statements, you must implement the ISelectValueFixture
interface. Examples of doing this can be found in the tests/*
projects and AdoNet.Databases
.
Create one public derived class from each XTestBase<T>
test base class. Add a public
constructor that takes an instance of your IDbFactoryFixture
implementation and passes it
to the base class.
As necessary, override failing test methods to customize/skip them for your provider.
See Version History.
Clone this repo.
Run the required database servers locally:
cd docker
docker compose up
Run the AdoNetApiTest
program:
- In Visual Studio 2017, set it as the Start Up Project and press
Ctrl+F5
to launch, or - From a command prompt:
dotnet run -p src\AdoNetApiTest\AdoNetApiTest.csproj
Note that some DB providers require the full .NET Framework 4.7; this program has only been tested on Windows (not with mono).
The program will run all providers' test suites, then open the results in your default browser.