Skip to content

Commit 52788ce

Browse files
committed
Add tests for Npgsql v7.x.
1 parent 80b3f71 commit 52788ce

13 files changed

+130
-0
lines changed

AdoNetApiTest.sln

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicrosoftSqlClient4.Tests",
4949
EndProject
5050
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicrosoftSqlite7.Tests", "tests\MicrosoftSqlite7.Tests\MicrosoftSqlite7.Tests.csproj", "{F3C88899-1392-4EB3-94AC-9C1B00F4B545}"
5151
EndProject
52+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Npgsql7.Tests", "tests\Npgsql7.Tests\Npgsql7.Tests.csproj", "{2DEADF63-7268-41E8-BFB5-F28DD8F9AEAC}"
53+
EndProject
5254
Global
5355
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5456
Debug|Any CPU = Debug|Any CPU
@@ -147,6 +149,10 @@ Global
147149
{F3C88899-1392-4EB3-94AC-9C1B00F4B545}.Debug|Any CPU.Build.0 = Debug|Any CPU
148150
{F3C88899-1392-4EB3-94AC-9C1B00F4B545}.Release|Any CPU.ActiveCfg = Release|Any CPU
149151
{F3C88899-1392-4EB3-94AC-9C1B00F4B545}.Release|Any CPU.Build.0 = Release|Any CPU
152+
{2DEADF63-7268-41E8-BFB5-F28DD8F9AEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
153+
{2DEADF63-7268-41E8-BFB5-F28DD8F9AEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
154+
{2DEADF63-7268-41E8-BFB5-F28DD8F9AEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
155+
{2DEADF63-7268-41E8-BFB5-F28DD8F9AEAC}.Release|Any CPU.Build.0 = Release|Any CPU
150156
EndGlobalSection
151157
GlobalSection(SolutionProperties) = preSolution
152158
HideSolutionNode = FALSE

docker/setup/setup.sh

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ docker exec -e PGPASSWORD=test ado-postgres-1 psql -U root -c "CREATE DATABASE d
1414
docker exec -e PGPASSWORD=test ado-postgres-1 psql -U root -c "CREATE DATABASE npgsql4;"
1515
docker exec -e PGPASSWORD=test ado-postgres-1 psql -U root -c "CREATE DATABASE npgsql5;"
1616
docker exec -e PGPASSWORD=test ado-postgres-1 psql -U root -c "CREATE DATABASE npgsql6;"
17+
docker exec -e PGPASSWORD=test ado-postgres-1 psql -U root -c "CREATE DATABASE npgsql7;"
1718
echo 'done'
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<Using Include="AdoNet.Specification.Tests" />
9+
<Using Include="System.Data.Common" />
10+
<Using Include="Npgsql" />
11+
<Using Include="Xunit" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
13+
<PackageReference Include="Npgsql" Version="7.0.0-rc.2" />
14+
<PackageReference Include="xunit" Version="2.4.2" />
15+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\..\src\AdoNet.Databases\AdoNet.Databases.csproj" />
20+
<ProjectReference Include="..\..\src\AdoNet.Specification.Tests\AdoNet.Specification.Tests.csproj" />
21+
</ItemGroup>
22+
23+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7CommandTests : CommandTestBase<Npgsql7DbFactoryFixture>
4+
{
5+
public Npgsql7CommandTests(Npgsql7DbFactoryFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7ConnectionStringBuilderTests : ConnectionStringTestBase<Npgsql7DbFactoryFixture>
4+
{
5+
public Npgsql7ConnectionStringBuilderTests(Npgsql7DbFactoryFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7ConnectionTests : ConnectionTestBase<Npgsql7DbFactoryFixture>
4+
{
5+
public Npgsql7ConnectionTests(Npgsql7DbFactoryFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7DataReaderTests : DataReaderTestBase<Npgsql7SelectValueFixture>
4+
{
5+
public Npgsql7DataReaderTests(Npgsql7SelectValueFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
10+
[Fact(Skip = "Deliberately throws InvalidCastException")]
11+
public override void GetTextReader_returns_empty_for_null_String() { }
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Npgsql7.Tests;
2+
3+
public class Npgsql7DbFactoryFixture : IDbFactoryFixture
4+
{
5+
public DbProviderFactory Factory => NpgsqlFactory.Instance;
6+
public string ConnectionString => "host=localhost;user id=root;password=test;database=npgsql7";
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7DbProviderFactoryTests : DbProviderFactoryTestBase<Npgsql7DbFactoryFixture>
4+
{
5+
public Npgsql7DbProviderFactoryTests(Npgsql7DbFactoryFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7GetValueConversionTests : GetValueConversionTestBase<Npgsql7SelectValueFixture>
4+
{
5+
public Npgsql7GetValueConversionTests(Npgsql7SelectValueFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7ParameterTests : ParameterTestBase<Npgsql7DbFactoryFixture>
4+
{
5+
public Npgsql7ParameterTests(Npgsql7DbFactoryFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using AdoNet.Databases;
5+
6+
namespace Npgsql7.Tests;
7+
8+
public sealed class Npgsql7SelectValueFixture : Npgsql7DbFactoryFixture, ISelectValueFixture, IDeleteFixture, IDisposable
9+
{
10+
public Npgsql7SelectValueFixture() => PostgreSqlDatabase.CreateSelectValueTable(this);
11+
public void Dispose() => PostgreSqlDatabase.DropSelectValueTable(this);
12+
public string CreateSelectSql(DbType dbType, ValueKind kind) => PostgreSqlDatabase.CreateSelectSql(dbType, kind);
13+
public string CreateSelectSql(byte[] value) => PostgreSqlDatabase.CreateSelectSql(value);
14+
public string SelectNoRows => PostgreSqlDatabase.SelectNoRows;
15+
public IReadOnlyCollection<DbType> SupportedDbTypes => PostgreSqlDatabase.SupportedDbTypes;
16+
public Type NullValueExceptionType => PostgreSqlDatabase.NullValueExceptionType;
17+
public string DeleteNoRows => PostgreSqlDatabase.DeleteNoRows;
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Npgsql7.Tests;
2+
3+
public sealed class Npgsql7TransactionTests : TransactionTestBase<Npgsql7DbFactoryFixture>
4+
{
5+
public Npgsql7TransactionTests(Npgsql7DbFactoryFixture fixture)
6+
: base(fixture)
7+
{
8+
}
9+
}

0 commit comments

Comments
 (0)