Skip to content

Commit 30a0b6b

Browse files
committedOct 20, 2023
Add package README.
1 parent 1f1a464 commit 30a0b6b

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
 

‎src/AdoNet.Specification.Tests/AdoNet.Specification.Tests.csproj

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<Authors>Bradley Grainger</Authors>
1414
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
1515
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
16+
<PackageReadmeFile>README.md</PackageReadmeFile>
1617
<PackageTags>ado.net;database;test</PackageTags>
1718
<PackageReleaseNotes>https://github.com/mysql-net/AdoNetApiTest/blob/master/VersionHistory.md</PackageReleaseNotes>
1819
<PackageProjectUrl>https://mysql-net.github.io/AdoNetResults/</PackageProjectUrl>
@@ -38,4 +39,8 @@
3839
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
3940
</ItemGroup>
4041

42+
<ItemGroup>
43+
<None Include="README.md" Pack="true" PackagePath="\" />
44+
</ItemGroup>
45+
4146
</Project>
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## ADO.NET Specification Tests
2+
3+
This package provides base classes that let you test your ADO.NET library for conformance to common ADO.NET patterns.
4+
ADO.NET doesn't have a formal specification for ADO.NET providers, but many libraries (such as
5+
[Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient),
6+
[Npgsql](https://www.nuget.org/packages/Npgsql), and [MySqlConnector](https://www.nuget.org/packages/MySqlConnector))
7+
exhibit similar behavior.
8+
9+
### Usage
10+
11+
Create a test project that uses [xunit](https://www.nuget.org/packages/xunit).
12+
13+
Write a class that implements `IDbFactoryFixture`:
14+
15+
```csharp
16+
public class DbFactoryFixture : IDbFactoryFixture
17+
{
18+
public DbFactoryFixture()
19+
{
20+
ConnectionString ="your test connection string";
21+
}
22+
23+
public string ConnectionString { get; }
24+
public DbProviderFactory Factory => YourDbProviderFactory.Instance;
25+
}
26+
```
27+
28+
Then write test classes that inherit from the classes in this package, e.g.,
29+
30+
```csharp
31+
public sealed class ConnectionTests : ConnectionTestBase<DbFactoryFixture>
32+
{
33+
public ConnectionTests(DbFactoryFixture fixture)
34+
: base(fixture)
35+
{
36+
}
37+
38+
[Fact(Skip = "Override a method and provide a 'Skip' reason to opt out of a test.")]
39+
public override void Set_ConnectionString_throws_when_invalid()
40+
{
41+
}
42+
}
43+
```

0 commit comments

Comments
 (0)
Please sign in to comment.