Skip to content

Commit a5906a4

Browse files
committed
Add Npgsql8 tests.
1 parent de1f001 commit a5906a4

13 files changed

+111
-0
lines changed

AdoNetApiTest.sln

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Npgsql7.Tests", "tests\Npgs
5353
EndProject
5454
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicrosoftSqlite8.Tests", "tests\MicrosoftSqlite8.Tests\MicrosoftSqlite8.Tests.csproj", "{FA8BDF08-7841-4F8D-9085-D1EFC2A46A7E}"
5555
EndProject
56+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Npgsql8.Tests", "tests\Npgsql8.Tests\Npgsql8.Tests.csproj", "{4D8B38D9-35AB-4808-8BBF-9C4A4BB17BA4}"
57+
EndProject
5658
Global
5759
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5860
Debug|Any CPU = Debug|Any CPU
@@ -159,6 +161,10 @@ Global
159161
{FA8BDF08-7841-4F8D-9085-D1EFC2A46A7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
160162
{FA8BDF08-7841-4F8D-9085-D1EFC2A46A7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
161163
{FA8BDF08-7841-4F8D-9085-D1EFC2A46A7E}.Release|Any CPU.Build.0 = Release|Any CPU
164+
{4D8B38D9-35AB-4808-8BBF-9C4A4BB17BA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
165+
{4D8B38D9-35AB-4808-8BBF-9C4A4BB17BA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
166+
{4D8B38D9-35AB-4808-8BBF-9C4A4BB17BA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
167+
{4D8B38D9-35AB-4808-8BBF-9C4A4BB17BA4}.Release|Any CPU.Build.0 = Release|Any CPU
162168
EndGlobalSection
163169
GlobalSection(SolutionProperties) = preSolution
164170
HideSolutionNode = FALSE

azure-pipelines.yml

+10
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ jobs:
122122
continueOnError: true
123123
env:
124124
ConnectionString: $(ConnectionString)
125+
- task: DotNetCoreCLI@2
126+
displayName: Npgsql 8
127+
inputs:
128+
command: 'test'
129+
workingDirectory: tests/Npgsql8.Tests
130+
publishTestResults: false
131+
arguments: '--logger "trx;LogFileName=$(Build.ArtifactStagingDirectory)/Npgsql8.Tests.trx"'
132+
continueOnError: true
133+
env:
134+
ConnectionString: $(ConnectionString)
125135
- task: PublishPipelineArtifact@0
126136
inputs:
127137
artifactName: PostgreSQL
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.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="Npgsql" Version="8.*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\..\src\AdoNet.Databases\AdoNet.Databases.csproj" />
17+
<ProjectReference Include="..\..\src\AdoNet.Specification.Tests\AdoNet.Specification.Tests.csproj" />
18+
</ItemGroup>
19+
20+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8CommandTests(Npgsql8DbFactoryFixture fixture)
4+
: CommandTestBase<Npgsql8DbFactoryFixture>(fixture)
5+
{
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8ConnectionStringBuilderTests(Npgsql8DbFactoryFixture fixture)
4+
: ConnectionStringTestBase<Npgsql8DbFactoryFixture>(fixture)
5+
{
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8ConnectionTests(Npgsql8DbFactoryFixture fixture)
4+
: ConnectionTestBase<Npgsql8DbFactoryFixture>(fixture)
5+
{
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8DataReaderTests(Npgsql8SelectValueFixture fixture)
4+
: DataReaderTestBase<Npgsql8SelectValueFixture>(fixture)
5+
{
6+
[Fact(Skip = "Deliberately throws InvalidCastException")]
7+
public override void GetTextReader_returns_empty_for_null_String() { }
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Npgsql8.Tests;
2+
3+
public class Npgsql8DbFactoryFixture : IDbFactoryFixture
4+
{
5+
public DbProviderFactory Factory => NpgsqlFactory.Instance;
6+
public string ConnectionString => "host=localhost;user id=root;password=test;database=Npgsql8";
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8DbProviderFactoryTests(Npgsql8DbFactoryFixture fixture)
4+
: DbProviderFactoryTestBase<Npgsql8DbFactoryFixture>(fixture)
5+
{
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8GetValueConversionTests(Npgsql8SelectValueFixture fixture)
4+
: GetValueConversionTestBase<Npgsql8SelectValueFixture>(fixture)
5+
{
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8ParameterTests(Npgsql8DbFactoryFixture fixture)
4+
: ParameterTestBase<Npgsql8DbFactoryFixture>(fixture)
5+
{
6+
}
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 Npgsql8.Tests;
7+
8+
public sealed class Npgsql8SelectValueFixture : Npgsql8DbFactoryFixture, ISelectValueFixture, IDeleteFixture, IDisposable
9+
{
10+
public Npgsql8SelectValueFixture() => 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,6 @@
1+
namespace Npgsql8.Tests;
2+
3+
public sealed class Npgsql8TransactionTests(Npgsql8DbFactoryFixture fixture)
4+
: TransactionTestBase<Npgsql8DbFactoryFixture>(fixture)
5+
{
6+
}

0 commit comments

Comments
 (0)