Skip to content

Commit

Permalink
Use Testcontainers.MsSql for unit tests (#820)
Browse files Browse the repository at this point in the history
* Use Testcontainers.MsSql

* x

* .

* windows-2022

* ubuntu

* inmem

* $"System.Linq.Dynamic.Core.{Guid.NewGuid()}"

* fix

* ubuntu-latest

* fix linux

* Run Tests EF net461

* contains

* Linux - no461

* net8.0 / UseInMemory: 'true'

* UseInMemory: 'true'

* remove net461

* EF

* --

* test projects

* ---

* -

* x
  • Loading branch information
StefH authored Jun 18, 2024
1 parent 0e2e1ee commit b7e5191
Show file tree
Hide file tree
Showing 51 changed files with 1,260 additions and 1,669 deletions.
54 changes: 35 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,58 @@ name: Build with Tests
on: [push]

jobs:
build:
runs-on: windows-2022
build_and_test_Windows:
name: Build and run Tests on Windows
runs-on: windows-latest

env:
IsRunningOnGitHubActions: 'true'
UseInMemory: 'true'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build
run: |
dotnet build ./src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj -c Release -p:buildType=azure-pipelines-ci
- name: Run Tests EFCore net8.0
run: |
dotnet test ./test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj -c Release -p:buildType=azure-pipelines-ci
build_and_test_Linux:
name: Build and run Tests on Linux
runs-on: ubuntu-latest

- uses: actions/setup-dotnet@v3
env:
IsRunningOnGitHubActions: 'true'

steps:
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Build Projects
- name: Build
run: |
dotnet build ./src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj -c Release -p:buildType=azure-pipelines-ci
- name: Run Tests net8.0
- name: Run Tests EF net8.0
run: |
dotnet build ./test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj -c Release -p:buildType=azure-pipelines-ci
dotnet test ./test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj -c Release -p:buildType=azure-pipelines-ci --no-build
dotnet test ./test/EntityFramework.DynamicLinq.Tests/EntityFramework.DynamicLinq.Tests.csproj -c Release -f net8.0 -p:buildType=azure-pipelines-ci
- name: Run Tests net7.0
- name: Run Tests EFCore net8.0
run: |
dotnet build ./test/System.Linq.Dynamic.Core.Tests.Net7/System.Linq.Dynamic.Core.Tests.Net7.csproj -c Release -p:buildType=azure-pipelines-ci
dotnet test ./test/System.Linq.Dynamic.Core.Tests.Net7/System.Linq.Dynamic.Core.Tests.Net7.csproj -c Release -p:buildType=azure-pipelines-ci --no-build
dotnet test ./test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj -c Release -p:buildType=azure-pipelines-ci
- name: Run Tests net6.0
- name: Run Tests EFCore net7.0
run: |
dotnet build ./test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj -c Release -p:buildType=azure-pipelines-ci
dotnet test ./test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj -c Release -p:buildType=azure-pipelines-ci --no-build
- name: Run Tests net452
dotnet test ./test/System.Linq.Dynamic.Core.Tests.Net7/System.Linq.Dynamic.Core.Tests.Net7.csproj -c Release -p:buildType=azure-pipelines-ci
- name: Run Tests EFCore net6.0
run: |
dotnet build ./test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj -c Release -f net452 -p:buildType=azure-pipelines-ci
dotnet test ./test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj -c Release -f net452 -p:buildType=azure-pipelines-ci --no-build
dotnet test ./test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj -c Release -p:buildType=azure-pipelines-ci
38 changes: 19 additions & 19 deletions System.Linq.Dynamic.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj", "{9000129D-322D-4FE6-9C47-75464577C374}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.Net8", "test\System.Linq.Dynamic.Core.Tests.Net8\System.Linq.Dynamic.Core.Tests.Net8.csproj", "{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RadzenDataGrid.BlazorApp", "src-blazor\RadzenDataGrid.BlazorApp\RadzenDataGrid.BlazorApp.csproj", "{51074A4C-15C2-4E72-81F2-2FC53903553B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_net6.0_EF6_Sqlite", "src-console\ConsoleAppEF6_Sqlite\ConsoleApp_net6.0_EF6_Sqlite.csproj", "{CA03FD55-9DAB-4827-9A35-A96D3804B311}"
Expand All @@ -145,6 +143,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Host", "src-console\De
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Plugin", "src-console\Demo.Plugin\Demo.Plugin.csproj", "{B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.NetCoreApp31", "test\System.Linq.Dynamic.Core.Tests.NetCoreApp31\System.Linq.Dynamic.Core.Tests.NetCoreApp31.csproj", "{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -769,22 +769,6 @@ Global
{9000129D-322D-4FE6-9C47-75464577C374}.Release|x64.Build.0 = Release|Any CPU
{9000129D-322D-4FE6-9C47-75464577C374}.Release|x86.ActiveCfg = Release|Any CPU
{9000129D-322D-4FE6-9C47-75464577C374}.Release|x86.Build.0 = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|ARM.ActiveCfg = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|ARM.Build.0 = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x64.ActiveCfg = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x64.Build.0 = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x86.ActiveCfg = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x86.Build.0 = Debug|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|Any CPU.Build.0 = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|ARM.ActiveCfg = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|ARM.Build.0 = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x64.ActiveCfg = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x64.Build.0 = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x86.ActiveCfg = Release|Any CPU
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x86.Build.0 = Release|Any CPU
{51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|ARM.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -897,6 +881,22 @@ Global
{B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x64.Build.0 = Release|Any CPU
{B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x86.ActiveCfg = Release|Any CPU
{B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x86.Build.0 = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|ARM.ActiveCfg = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|ARM.Build.0 = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x64.ActiveCfg = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x64.Build.0 = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x86.ActiveCfg = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x86.Build.0 = Debug|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|Any CPU.Build.0 = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|ARM.ActiveCfg = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|ARM.Build.0 = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x64.ActiveCfg = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x64.Build.0 = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x86.ActiveCfg = Release|Any CPU
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -940,14 +940,14 @@ Global
{FB2F4C99-EC34-4D29-87E2-944B25D90EF7} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F}
{CC63ECEB-18C1-462B-BAFC-7F146A7C2740} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38}
{9000129D-322D-4FE6-9C47-75464577C374} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F}
{ABB1BF71-8927-49BB-99F3-70BCB2CD161E} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38}
{51074A4C-15C2-4E72-81F2-2FC53903553B} = {122BC4FA-7563-4E35-9D17-077F16F1629F}
{CA03FD55-9DAB-4827-9A35-A96D3804B311} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{E36D1A08-F3ED-48C7-9DBF-8F625974A6C4} = {BCA2A024-9032-4E56-A6C4-17A15D921728}
{9E0D0994-7D84-40FF-8383-189F142FEF11} = {BCA2A024-9032-4E56-A6C4-17A15D921728}
{68C7FF71-54F6-4D68-B419-65D1B10206D4} = {BCA2A024-9032-4E56-A6C4-17A15D921728}
{D8368319-F370-4071-9411-A3DADB234330} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{B01B327C-FC68-49B6-BDE3-A13D0C66DF5C} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20}
Expand Down
35 changes: 0 additions & 35 deletions src/System.Linq.Dynamic.Core/DynamicExpressionArgument.cs

This file was deleted.

25 changes: 0 additions & 25 deletions src/System.Linq.Dynamic.Core/Extensions/ExpandObjectExtensions.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/System.Linq.Dynamic.Core/Extensions/LinqExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ namespace System.Linq.Dynamic.Core.Extensions;
[SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
internal static class LinqExtensions
{
// Ex: collection.TakeLast(5);
public static IEnumerable<T> TakeLast<T>(this IList<T> source, int n)
{
return source.Skip(Math.Max(0, source.Count() - n));
}

public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> sequence)
{
Check.NotNull(sequence);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Authors>Stef Heyenrath</Authors>
<TargetFramework>net461</TargetFramework>
<TargetFrameworks>net461;net8.0</TargetFrameworks>
<LangVersion>10</LangVersion>
<DefineConstants>EF;NET461</DefineConstants>
<AssemblyName>EntityFramework.DynamicLinq.Tests</AssemblyName>
Expand Down Expand Up @@ -40,23 +40,32 @@
<PackageReference Include="MongoDB.Driver" Version="2.19.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NodaTime" Version="2.4.7" />
<PackageReference Include="Testcontainers.MsSql" Version="3.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Linq.PropertyTranslator.Core" Version="1.0.5" />
<PackageReference Include="QueryInterceptor.Core" Version="1.0.7" />
<!--<PackageReference Include="EntityFramework" Version="6.2.0" />-->
<PackageReference Include="Microsoft.AspNet.Identity.EntityFramework" Version="2.2.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="NFluent" Version="2.8.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="LinqKit.EntityFramework" Version="1.1.15" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.AspNet.Identity.EntityFramework" Version="2.2.1" />
<PackageReference Include="LinqKit.EntityFramework" Version="1.1.15" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="8.1.5" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<DefineConstants>$(DefineConstants);AspNetCoreIdentity</DefineConstants>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
<DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1</DefineConstants>
<DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1;AspNetCoreIdentity</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand All @@ -35,6 +35,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
<PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="5.1.2" />
<PackageReference Include="NodaTime" Version="3.1.5" />
<PackageReference Include="Testcontainers.MsSql" Version="3.8.0" />

<ProjectReference Include="..\..\src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore5\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore5.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
<DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1</DefineConstants>
<DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1;AspNetCoreIdentity</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -38,6 +38,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
<PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="6.1.2" />
<PackageReference Include="NodaTime" Version="3.1.5" />
<PackageReference Include="Testcontainers.MsSql" Version="3.8.0" />

<ProjectReference Include="..\..\src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<AssemblyOriginatorKeyFile>../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1</DefineConstants>
<DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1;AspNetCoreIdentity</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -39,6 +39,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
<PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="7.1.3" />
<PackageReference Include="NodaTime" Version="3.1.5" />
<PackageReference Include="Testcontainers.MsSql" Version="3.8.0" />

<ProjectReference Include="..\..\src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore7\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore7.csproj" />
</ItemGroup>
Expand Down
Loading

0 comments on commit b7e5191

Please sign in to comment.