mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Collapsed EF integration tests into main integration test project
This commit is contained in:
parent
ebced8d5c3
commit
dcf3d41d2e
20 changed files with 59 additions and 122 deletions
2
.github/workflow-gen/Program.cs
vendored
2
.github/workflow-gen/Program.cs
vendored
|
|
@ -20,7 +20,7 @@ var products = new Product[]
|
|||
new("identity-server",
|
||||
"identity-server.slnf",
|
||||
"is",
|
||||
["Configuration.IntegrationTests", "EntityFramework.IntegrationTests", "EntityFramework.Storage.UnitTests", "IdentityServer.IntegrationTests", "IdentityServer.UnitTests"],
|
||||
["Configuration.IntegrationTests", "EntityFramework.Storage.UnitTests", "IdentityServer.IntegrationTests", "IdentityServer.UnitTests"],
|
||||
[])
|
||||
};
|
||||
foreach (var product in products)
|
||||
|
|
|
|||
14
.github/workflows/identity-server-ci.yml
vendored
14
.github/workflows/identity-server-ci.yml
vendored
|
|
@ -104,20 +104,6 @@ jobs:
|
|||
fail-on-empty: true
|
||||
- name: Publish test report link
|
||||
run: echo "[Test Results - test/Configuration.IntegrationTests](${{ steps.test-report-test-Configuration-IntegrationTests.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
|
||||
- name: Test - test/EntityFramework.IntegrationTests
|
||||
run: dotnet test test/EntityFramework.IntegrationTests -c Release --no-build --logger "console;verbosity=normal" --logger "trx;LogFileName=test/EntityFramework.IntegrationTests-tests.trx" --collect:"XPlat Code Coverage"
|
||||
- id: test-report-test-EntityFramework-IntegrationTests
|
||||
name: Test report - test/EntityFramework.IntegrationTests
|
||||
if: github.event_name == 'push' && (success() || failure())
|
||||
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
|
||||
with:
|
||||
name: Test Report - test/EntityFramework.IntegrationTests
|
||||
path: '**/test/EntityFramework.IntegrationTests-tests.trx'
|
||||
reporter: dotnet-trx
|
||||
fail-on-error: true
|
||||
fail-on-empty: true
|
||||
- name: Publish test report link
|
||||
run: echo "[Test Results - test/EntityFramework.IntegrationTests](${{ steps.test-report-test-EntityFramework-IntegrationTests.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
|
||||
- name: Test - test/EntityFramework.Storage.UnitTests
|
||||
run: dotnet test test/EntityFramework.Storage.UnitTests -c Release --no-build --logger "console;verbosity=normal" --logger "trx;LogFileName=test/EntityFramework.Storage.UnitTests-tests.trx" --collect:"XPlat Code Coverage"
|
||||
- id: test-report-test-EntityFramework-Storage-UnitTests
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@
|
|||
"identity-server\\templates\\src\\IdentityServerEntityFramework\\IdentityServerEntityFramework.csproj",
|
||||
"identity-server\\templates\\src\\IdentityServerInMem\\IdentityServerInMem.csproj",
|
||||
"identity-server\\test\\Configuration.IntegrationTests\\Configuration.IntegrationTests.csproj",
|
||||
"identity-server\\test\\EntityFramework.IntegrationTests\\EntityFramework.IntegrationTests.csproj",
|
||||
"identity-server\\test\\EntityFramework.Storage.UnitTests\\EntityFramework.Storage.UnitTests.csproj",
|
||||
"identity-server\\test\\IdentityServer.IntegrationTests\\IdentityServer.IntegrationTests.csproj",
|
||||
"identity-server\\test\\IdentityServer.UnitTests\\IdentityServer.UnitTests.csproj",
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- This is a transitive dependency of Microsoft.EntityFrameworkCore.SqlServer.
|
||||
Without pinning a version of this package, the sql server package would bring in
|
||||
an older version that in turn depends on vulnerable packages. Someday, it would
|
||||
be nice if we could update Microsoft.EntityFrameworkCore.SqlServer and remove
|
||||
this explicit dependency (assuming that future versions of
|
||||
Microsoft.EntityFrameworkCore.SqlServer that don't have this problem exist). -->
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\shared\ShouldlyExtensions\ShouldlyExtensions.csproj" />
|
||||
<ProjectReference
|
||||
Include="..\..\src\EntityFramework\Duende.IdentityServer.EntityFramework.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace EntityFramework.IntegrationTests;
|
||||
|
||||
public class FakeLogger<T> : FakeLogger, ILogger<T>
|
||||
{
|
||||
public static ILogger<T> Create() => new FakeLogger<T>();
|
||||
}
|
||||
|
||||
public class FakeLogger : ILogger, IDisposable
|
||||
{
|
||||
public IDisposable BeginScope<TState>(TState state) => this;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel) => false;
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ using Duende.IdentityServer.EntityFramework.Services;
|
|||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace EntityFramework.IntegrationTests.Services;
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ public class CorsPolicyServiceTests : IntegrationTest<CorsPolicyServiceTests, Co
|
|||
bool result;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var service = new CorsPolicyService(context, FakeLogger<CorsPolicyService>.Create(), new NoneCancellationTokenProvider());
|
||||
var service = new CorsPolicyService(context, new NullLogger<CorsPolicyService>(), new NoneCancellationTokenProvider());
|
||||
result = await service.IsOriginAllowedAsync(testCorsOrigin);
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +73,7 @@ public class CorsPolicyServiceTests : IntegrationTest<CorsPolicyServiceTests, Co
|
|||
bool result;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var service = new CorsPolicyService(context, FakeLogger<CorsPolicyService>.Create(), new NoneCancellationTokenProvider());
|
||||
var service = new CorsPolicyService(context, new NullLogger<CorsPolicyService>(), new NoneCancellationTokenProvider());
|
||||
result = await service.IsOriginAllowedAsync("InvalidOrigin");
|
||||
}
|
||||
|
||||
|
|
@ -9,6 +9,7 @@ using Duende.IdentityServer.EntityFramework.Stores;
|
|||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace EntityFramework.IntegrationTests.Storage.Stores;
|
||||
|
|
@ -28,7 +29,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
public async Task FindClientByIdAsync_WhenClientDoesNotExist_ExpectNull(DbContextOptions<ConfigurationDbContext> options)
|
||||
{
|
||||
await using var context = new ConfigurationDbContext(options);
|
||||
var store = new ClientStore(context, FakeLogger<ClientStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var client = await store.FindClientByIdAsync(Guid.NewGuid().ToString());
|
||||
client.ShouldBeNull();
|
||||
}
|
||||
|
|
@ -51,7 +52,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
Client client;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, FakeLogger<ClientStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
client = await store.FindClientByIdAsync(testClient.ClientId);
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +86,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
Client client;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, FakeLogger<ClientStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
client = await store.FindClientByIdAsync(testClient.ClientId);
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +147,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, FakeLogger<ClientStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
const int timeout = 5000;
|
||||
var task = Task.Run(() => store.FindClientByIdAsync(testClient.ClientId));
|
||||
|
|
@ -13,6 +13,7 @@ using Duende.IdentityServer.Services;
|
|||
using Duende.IdentityServer.Stores.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace EntityFramework.IntegrationTests.Storage.Stores;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
await store.StoreDeviceAuthorizationAsync(deviceCode, userCode, data);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +72,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
await store.StoreDeviceAuthorizationAsync(deviceCode, userCode, data);
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +121,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
// skip odd behaviour of in-memory provider
|
||||
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||
|
|
@ -165,7 +166,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
// skip odd behaviour of in-memory provider
|
||||
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||
|
|
@ -213,7 +214,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
DeviceCode code;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
code = await store.FindByUserCodeAsync(testUserCode);
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +235,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
{
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var code = await store.FindByUserCodeAsync($"user_{Guid.NewGuid().ToString()}");
|
||||
code.ShouldBeNull();
|
||||
}
|
||||
|
|
@ -275,7 +276,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
DeviceCode code;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
code = await store.FindByDeviceCodeAsync(testDeviceCode);
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +296,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
{
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var code = await store.FindByDeviceCodeAsync($"device_{Guid.NewGuid().ToString()}");
|
||||
code.ShouldBeNull();
|
||||
}
|
||||
|
|
@ -345,7 +346,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
await store.UpdateByUserCodeAsync(testUserCode, authorizedDeviceCode);
|
||||
}
|
||||
|
||||
|
|
@ -408,7 +409,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
await store.RemoveByDeviceCodeAsync(testDeviceCode);
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +423,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
{
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), FakeLogger<DeviceFlowStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
await store.RemoveByDeviceCodeAsync($"device_{Guid.NewGuid().ToString()}");
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ using Duende.IdentityServer.EntityFramework.Stores;
|
|||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace EntityFramework.IntegrationTests.Storage.Stores;
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ public class IdentityProviderStoreTests : IntegrationTest<IdentityProviderStoreT
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new IdentityProviderStore(context, FakeLogger<IdentityProviderStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>(), new NoneCancellationTokenProvider());
|
||||
var item = await store.GetBySchemeAsync("scheme1");
|
||||
|
||||
item.ShouldNotBeNull();
|
||||
|
|
@ -65,7 +66,7 @@ public class IdentityProviderStoreTests : IntegrationTest<IdentityProviderStoreT
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new IdentityProviderStore(context, FakeLogger<IdentityProviderStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>(), new NoneCancellationTokenProvider());
|
||||
var item = await store.GetBySchemeAsync("scheme2");
|
||||
|
||||
item.ShouldBeNull();
|
||||
|
|
@ -88,7 +89,7 @@ public class IdentityProviderStoreTests : IntegrationTest<IdentityProviderStoreT
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new IdentityProviderStore(context, FakeLogger<IdentityProviderStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>(), new NoneCancellationTokenProvider());
|
||||
var item = await store.GetBySchemeAsync("scheme3");
|
||||
|
||||
item.ShouldBeNull();
|
||||
|
|
@ -10,6 +10,7 @@ using Duende.IdentityServer.Models;
|
|||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace EntityFramework.IntegrationTests.Storage.Stores;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
await store.StoreAsync(persistedGrant);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PersistedGrant foundPersistedGrant;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
foundPersistedGrant = await store.GetAsync(persistedGrant.Key);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +90,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
IList<PersistedGrant> foundPersistedGrants;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
foundPersistedGrants = (await store.GetAllAsync(new PersistedGrantFilter { SubjectId = persistedGrant.SubjectId })).ToList();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
(await store.GetAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -190,7 +191,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
await store.RemoveAsync(persistedGrant.Key);
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
SubjectId = persistedGrant.SubjectId,
|
||||
|
|
@ -242,7 +243,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
SubjectId = persistedGrant.SubjectId,
|
||||
|
|
@ -284,7 +285,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -296,7 +297,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -308,7 +309,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -321,7 +322,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -334,7 +335,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -347,7 +348,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -360,7 +361,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -374,7 +375,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -388,7 +389,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -403,7 +404,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -429,7 +430,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
await store.StoreAsync(persistedGrant);
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +455,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
var newDate = persistedGrant.Expiration.Value.AddHours(1);
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, FakeLogger<PersistedGrantStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
persistedGrant.Expiration = newDate;
|
||||
await store.StoreAsync(persistedGrant);
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ using Duende.IdentityServer.EntityFramework.Stores;
|
|||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace EntityFramework.IntegrationTests.Storage.Stores;
|
||||
|
||||
|
|
@ -74,7 +75,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
ApiResource foundResource;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
foundResource = (await store.FindApiResourcesByNameAsync(new[] { resource.Name })).SingleOrDefault();
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
ApiResource foundResource;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
foundResource = (await store.FindApiResourcesByNameAsync(new[] { resource.Name })).SingleOrDefault();
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +136,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IEnumerable<ApiResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = await store.FindApiResourcesByScopeNameAsync(new List<string>
|
||||
{
|
||||
testApiScope.Name
|
||||
|
|
@ -169,7 +170,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IEnumerable<ApiResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = await store.FindApiResourcesByScopeNameAsync(new[] { testApiScope.Name });
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +193,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<IdentityResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = (await store.FindIdentityResourcesByScopeNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -223,7 +224,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<IdentityResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = (await store.FindIdentityResourcesByScopeNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -249,7 +250,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<ApiScope> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = (await store.FindApiScopesByNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -280,7 +281,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<ApiScope> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = (await store.FindApiScopesByNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -327,7 +328,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
Resources resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, FakeLogger<ResourceStore>.Create(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
resources = await store.GetAllResourcesAsync();
|
||||
}
|
||||
|
||||
|
|
@ -11,6 +11,9 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
|
||||
<PackageReference Include="AngleSharp" />
|
||||
|
||||
|
|
@ -41,6 +44,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\shared\ShouldlyExtensions\ShouldlyExtensions.csproj" />
|
||||
<ProjectReference Include="..\..\src\EntityFramework\Duende.IdentityServer.EntityFramework.csproj" />
|
||||
<ProjectReference Include="..\..\src\IdentityServer\Duende.IdentityServer.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@
|
|||
</Folder>
|
||||
<Folder Name="/identity-server/test/">
|
||||
<Project Path="identity-server/test/Configuration.IntegrationTests/Configuration.IntegrationTests.csproj" />
|
||||
<Project Path="identity-server/test/EntityFramework.IntegrationTests/EntityFramework.IntegrationTests.csproj" />
|
||||
<Project Path="identity-server/test/EntityFramework.Storage.UnitTests/EntityFramework.Storage.UnitTests.csproj" />
|
||||
<Project Path="identity-server/test/IdentityServer.IntegrationTests/IdentityServer.IntegrationTests.csproj" />
|
||||
<Project Path="identity-server/test/IdentityServer.UnitTests/IdentityServer.UnitTests.csproj" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue