Skip to content

Commit 89678fd

Browse files
authored
Merge pull request #1194 from rhuijben/fix/all-integration-tests
Fix all unit and integration tests.
2 parents a817062 + 38745a4 commit 89678fd

File tree

88 files changed

+3271
-2254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3271
-2254
lines changed

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
tab_width = 4
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
end_of_line = lf
11+
12+
[*.{csproj,props,build}]
13+
indent_size = 2
14+
15+
[*.{cs,vb}]
16+
# Organize usings
17+
dotnet_separate_import_directive_groups = false
18+
dotnet_sort_system_directives_first = true
19+
20+
[*.cs]
21+
# CS1574: XML comment has cref attribute that could not be resolved
22+
dotnet_diagnostic.CS1574.severity = none

.github/workflows/build-pr.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build & Run Tests for PR
2+
on:
3+
pull_request:
4+
5+
env:
6+
REPODB_SQLSERVER_CONSTR_MASTER: "Server=tcp:127.0.0.1,41433;Database=master;User ID=sa;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;TrustServerCertificate=True;"
7+
REPODB_SQLSERVER_CONSTR_REPODB: "Server=tcp:127.0.0.1,41433;Database=RepoDb;User ID=sa;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;TrustServerCertificate=True;"
8+
REPODB_SQLSERVER_CONSTR_REPODBTEST: "Server=tcp:127.0.0.1,41433;Database=RepoDbTest;User ID=sa;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;TrustServerCertificate=True;"
9+
REPODB_POSTGRESQL_CONSTR_POSTGRESDB: "Server=127.0.0.1;Port=45432;Database=postgres;User Id=postgres;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
10+
REPODB_POSTGRESQL_CONSTR: "Server=127.0.0.1;Port=45432;Database=RepoDb;User Id=postgres;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
11+
REPODB_POSTGRESQL_CONSTR_BULK: "Server=127.0.0.1;Port=45432;Database=RepoDbBulk;User Id=postgres;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
12+
REPODB_MYSQL_CONSTR_SYS: "Server=127.0.0.1;Port=43306;Database=sys;User ID=root;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
13+
REPODB_MYSQL_CONSTR_REPODB: "Server=127.0.0.1;Port=43306;Database=RepoDb;User ID=root;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
14+
REPODB_MYSQL_CONSTR_REPODBTEST: "Server=127.0.0.1;Port=43306;Database=RepoDbTest;User ID=root;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
# Services. See docker-compose.yml
21+
services:
22+
mssql:
23+
image: mcr.microsoft.com/mssql/server:2022-latest
24+
ports:
25+
- 127.0.0.1:41433:1433
26+
env:
27+
ACCEPT_EULA: true
28+
MSSQL_SA_PASSWORD: ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2
29+
30+
postgresql:
31+
image: postgres:latest
32+
ports:
33+
- 127.0.0.1:45432:5432
34+
env:
35+
POSTGRES_PASSWORD: ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2
36+
37+
mysql:
38+
image: mysql:latest
39+
ports:
40+
- 127.0.0.1:43306:3306
41+
env:
42+
MYSQL_ROOT_PASSWORD: ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2
43+
44+
steps:
45+
- name: Check out repository code
46+
uses: actions/checkout@v4
47+
48+
- name: Setup .NET Versions
49+
uses: actions/setup-dotnet@v4
50+
with:
51+
dotnet-version: |
52+
6.0.x
53+
7.0.x
54+
8.0.x
55+
56+
- name: build
57+
run: dotnet build -c release
58+
59+
- name: test
60+
run: dotnet test -c release -f net8.0 --no-build -p:TestingPlatformShowTestsFailure=true -p:TestingPlatformCaptureOutput=false
61+
62+
- name: pack packages
63+
run: dotnet pack -c release -p Version="1.14.0-dev-pr-${{ github.run_number }}" -o release RepoDb.Core/RepoDb.All.sln
64+
65+
- name: Package nupkg files
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: release
69+
path: release/*nupkg

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build & Run Tests (Push)
2+
on:
3+
push
4+
5+
env:
6+
REPODB_SQLSERVER_CONSTR_MASTER: "Server=tcp:127.0.0.1,41433;Database=master;User ID=sa;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;TrustServerCertificate=True;"
7+
REPODB_SQLSERVER_CONSTR_REPODB: "Server=tcp:127.0.0.1,41433;Database=RepoDb;User ID=sa;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;TrustServerCertificate=True;"
8+
REPODB_SQLSERVER_CONSTR_REPODBTEST: "Server=tcp:127.0.0.1,41433;Database=RepoDbTest;User ID=sa;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;TrustServerCertificate=True;"
9+
REPODB_POSTGRESQL_CONSTR_POSTGRESDB: "Server=127.0.0.1;Port=45432;Database=postgres;User Id=postgres;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
10+
REPODB_POSTGRESQL_CONSTR: "Server=127.0.0.1;Port=45432;Database=RepoDb;User Id=postgres;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
11+
REPODB_POSTGRESQL_CONSTR_BULK: "Server=127.0.0.1;Port=45432;Database=RepoDbBulk;User Id=postgres;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
12+
REPODB_MYSQL_CONSTR_SYS: "Server=127.0.0.1;Port=43306;Database=sys;User ID=root;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
13+
REPODB_MYSQL_CONSTR_REPODB: "Server=127.0.0.1;Port=43306;Database=RepoDb;User ID=root;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
14+
REPODB_MYSQL_CONSTR_REPODBTEST: "Server=127.0.0.1;Port=43306;Database=RepoDbTest;User ID=root;Password=ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2;"
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
# Services. See docker-compose.yml
21+
services:
22+
mssql:
23+
image: mcr.microsoft.com/mssql/server:2022-latest
24+
ports:
25+
- 127.0.0.1:41433:1433
26+
env:
27+
ACCEPT_EULA: true
28+
MSSQL_SA_PASSWORD: ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2
29+
30+
postgresql:
31+
image: postgres:latest
32+
ports:
33+
- 127.0.0.1:45432:5432
34+
env:
35+
POSTGRES_PASSWORD: ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2
36+
37+
mysql:
38+
image: mysql:latest
39+
ports:
40+
- 127.0.0.1:43306:3306
41+
env:
42+
MYSQL_ROOT_PASSWORD: ddd53e85-b15e-4da8-91e5-a7d3b00a0ab2
43+
44+
steps:
45+
- name: Check out repository code
46+
uses: actions/checkout@v4
47+
48+
- name: Setup .NET Versions
49+
uses: actions/setup-dotnet@v4
50+
with:
51+
dotnet-version: |
52+
6.0.x
53+
7.0.x
54+
8.0.x
55+
56+
- name: build
57+
run: dotnet build -c release RepoDb.Core/RepoDb.All.sln
58+
59+
- name: test for .Net 8.0
60+
run: dotnet test -c release -f net8.0 --no-build -p:TestingPlatformShowTestsFailure=true -p:TestingPlatformCaptureOutput=false RepoDb.Core/RepoDb.All.sln
61+
62+
- name: pack packages
63+
run: dotnet pack -c release -p Version="1.14.0-dev-${{ github.run_number }}" -o release RepoDb.Core/RepoDb.All.sln
64+
65+
- name: Package nupkg files
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: release
69+
path: release/*nupkg

Directory.Build.props

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33
<PropertyGroup>
4-
<Authors>Michael Camara Pendon</Authors>
4+
<Authors>Michael Camara Pendon and others</Authors>
55
<Company>RepoDb</Company>
66
<Product>RepoDb</Product>
7+
<Version Condition="'$(Version)' == ''">0.0.1-dev</Version>
78
<LangVersion>default</LangVersion>
8-
<Copyright>Copyright © 2020</Copyright>
9+
<Copyright>Copyright © 2020-2024</Copyright>
910
<PackageProjectUrl>https://repodb.net/</PackageProjectUrl>
1011
<RepositoryType>Github</RepositoryType>
1112
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
13+
<PackageReadmeFile>README.md</PackageReadmeFile>
14+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
15+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
16+
<DebugType>portable</DebugType>
17+
<IncludeSymbols>true</IncludeSymbols>
18+
<Nullable>annotations</Nullable>
19+
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
20+
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
1221
</PropertyGroup>
13-
</Project>
22+
<Target Name="SetGenerateBeforeBuild" BeforeTargets="Build">
23+
<!-- IsPackable is set in project files, so delay evaluating this -->
24+
<PropertyGroup>
25+
<GenerateDocumentationFile Condition="'$(IsPackable)' != 'false'">true</GenerateDocumentationFile>
26+
</PropertyGroup>
27+
</Target>
28+
</Project>

Directory.Packages.props

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
5+
<NoWarn>$(NoWarn);NU1507</NoWarn>
6+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
10+
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.4.0" />
11+
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
12+
<PackageVersion Include="Dapper" Version="2.1.35" />
13+
<PackageVersion Include="Dapper.Contrib" Version="2.0.78" />
14+
<PackageVersion Include="linq2db" Version="5.3.2" />
15+
<PackageVersion Include="linq2db.PostgreSQL" Version="5.3.2" />
16+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
17+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
18+
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
19+
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.0" />
20+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
21+
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
22+
<PackageVersion Include="Microsoft.SqlServer.Types" Version="160.1000.6" />
23+
<PackageVersion Include="Moq" Version="4.20.72" />
24+
<PackageVersion Include="MSTest" Version="3.6.2" />
25+
<PackageVersion Include="MySql.Data" Version="9.1.0" />
26+
<PackageVersion Include="MySqlConnector" Version="2.3.0" />
27+
<PackageVersion Include="NHibernate" Version="5.5.2" />
28+
<PackageVersion Include="Npgsql" Version="7.0.8" />
29+
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.0" />
30+
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
31+
<PackageVersion Include="System.Data.Common" Version="4.3.0" />
32+
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.118" />
33+
<PackageVersion Include="System.Dynamic.Runtime" Version="4.3.0" />
34+
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
35+
<PackageVersion Include="System.Memory" Version="4.5.5" />
36+
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
37+
<PackageVersion Include="System.Reflection.Emit" Version="4.7.0" />
38+
<PackageVersion Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
39+
<PackageVersion Include="System.Reflection.TypeExtensions" Version="4.7.0" />
40+
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
41+
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
42+
</ItemGroup>
43+
</Project>
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<IsPackable>false</IsPackable>
66
</PropertyGroup>
7-
87
<ItemGroup>
9-
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
10-
<PackageReference Include="Dapper" Version="2.1.21" />
11-
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
12-
<PackageReference Include="linq2db" Version="5.3.2" />
13-
<PackageReference Include="linq2db.PostgreSQL" Version="5.3.2" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
15-
<PackageReference Include="NHibernate" Version="5.4.6" />
16-
<PackageReference Include="Npgsql" Version="7.0.6" />
17-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.0" />
8+
<PackageReference Include="BenchmarkDotNet" />
9+
<PackageReference Include="Dapper" />
10+
<PackageReference Include="Dapper.Contrib" />
11+
<PackageReference Include="linq2db" />
12+
<PackageReference Include="linq2db.PostgreSQL" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore" />
14+
<PackageReference Include="NHibernate" />
15+
<PackageReference Include="Npgsql" />
16+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
1817
</ItemGroup>
19-
2018
<ItemGroup>
2119
<ProjectReference Include="..\..\RepoDb.PostgreSql\RepoDb.PostgreSql\RepoDb.PostgreSql.csproj" />
2220
</ItemGroup>
23-
24-
</Project>
21+
</Project>
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<IsPackable>false</IsPackable>
66
</PropertyGroup>
7-
87
<ItemGroup>
9-
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
10-
<PackageReference Include="Dapper" Version="2.1.21" />
11-
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
12-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
14-
<PackageReference Include="NHibernate" Version="5.4.6" />
15-
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
8+
<PackageReference Include="BenchmarkDotNet" />
9+
<PackageReference Include="Dapper" />
10+
<PackageReference Include="Dapper.Contrib" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
13+
<PackageReference Include="NHibernate" />
14+
<PackageReference Include="System.Linq.Async" />
1615
</ItemGroup>
17-
1816
<ItemGroup>
1917
<ProjectReference Include="..\..\RepoDb.Extensions\RepoDb.SqlServer.BulkOperations\RepoDb.SqlServer.BulkOperations\RepoDb.SqlServer.BulkOperations.csproj" />
2018
<ProjectReference Include="..\..\RepoDb.PostgreSql\RepoDb.PostgreSql\RepoDb.PostgreSql.csproj" />
2119
<ProjectReference Include="..\..\RepoDb.SqlServer\RepoDb.SqlServer\RepoDb.SqlServer.csproj" />
2220
</ItemGroup>
23-
24-
</Project>
21+
</Project>

RepoDb.Core/.editorconfig

Lines changed: 0 additions & 4 deletions
This file was deleted.

RepoDb.Core/RepoDb.Tests/RepoDb.IntegrationTests/BaseEnferredInheritanceTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using Microsoft.Data.SqlClient;
32
using System.Linq;
3+
using Microsoft.Data.SqlClient;
44
using Microsoft.VisualStudio.TestTools.UnitTesting;
55
using RepoDb.IntegrationTests.Models;
66
using RepoDb.IntegrationTests.Setup;
@@ -100,6 +100,7 @@ public void TestSqlConnectionInsertForInherited()
100100
public void TestSqlConnectionInsertAllForInherited()
101101
{
102102
// Setup
103+
// warning CA2021: This call will always result in an empty sequence because type 'RepoDb.IntegrationTests.Models.InheritedIdentityTable' is incompatible with type 'RepoDb.IntegrationTests.Models.Entity<RepoDb.IntegrationTests.Models.InheritedIdentityTable>' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2021)
103104
var entities = Helper.CreateInheritedIdentityTables(10)
104105
.OfType<Entity<InheritedIdentityTable>>().ToList();
105106

@@ -192,6 +193,7 @@ public void TestSqlConnectionMergeForInheritedWithNonEmptyTable()
192193
public void TestSqlConnectionMergeAllForInherited()
193194
{
194195
// Setup
196+
// warning CA2021: This call will always result in an empty sequence because type 'RepoDb.IntegrationTests.Models.InheritedIdentityTable' is incompatible with type 'RepoDb.IntegrationTests.Models.Entity<RepoDb.IntegrationTests.Models.InheritedIdentityTable>' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2021)
195197
var entities = Helper.CreateInheritedIdentityTables(10)
196198
.OfType<Entity<InheritedIdentityTable>>().ToList();
197199

@@ -217,6 +219,7 @@ public void TestSqlConnectionMergeAllForInherited()
217219
public void TestSqlConnectionMergeAllForInheritedWithNonEmptyTables()
218220
{
219221
// Setup
222+
// warning CA2021: This call will always result in an empty sequence because type 'RepoDb.IntegrationTests.Models.InheritedIdentityTable' is incompatible with type 'RepoDb.IntegrationTests.Models.Entity<RepoDb.IntegrationTests.Models.InheritedIdentityTable>' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2021)
220223
var entities = Helper.CreateInheritedIdentityTables(10)
221224
.OfType<Entity<InheritedIdentityTable>>().ToList();
222225

@@ -344,6 +347,7 @@ public void TestSqlConnectionUpdateForInheritedViaPrimaryKey()
344347
public void TestSqlConnectionUpdateAllForInherited()
345348
{
346349
// Setup
350+
// warning CA2021: This call will always result in an empty sequence because type 'RepoDb.IntegrationTests.Models.InheritedIdentityTable' is incompatible with type 'RepoDb.IntegrationTests.Models.Entity<RepoDb.IntegrationTests.Models.InheritedIdentityTable>' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2021)
347351
var entities = Helper.CreateInheritedIdentityTables(10)
348352
.OfType<Entity<InheritedIdentityTable>>().ToList();
349353

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Globalization;
4-
using System.Text;
53

64
namespace RepoDb.IntegrationTests
75
{
@@ -11,16 +9,20 @@ namespace RepoDb.IntegrationTests
119
/// </summary>
1210
internal sealed class CultureScope : IDisposable
1311
{
14-
private readonly CultureInfo original;
12+
private readonly CultureInfo originalCulture;
13+
private readonly CultureInfo originalUICulture;
14+
1515
public CultureScope(string cultureName)
1616
{
17-
original = CultureInfo.DefaultThreadCurrentCulture;
18-
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo(cultureName);
17+
originalCulture = CultureInfo.CurrentCulture;
18+
originalUICulture = CultureInfo.CurrentUICulture;
19+
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(cultureName);
1920
}
2021

2122
public void Dispose()
2223
{
23-
CultureInfo.DefaultThreadCurrentCulture = original;
24+
CultureInfo.CurrentUICulture = originalUICulture;
25+
CultureInfo.CurrentCulture = originalCulture;
2426
}
2527
}
2628
}

0 commit comments

Comments
 (0)