diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 29f91e10..efc669d1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,7 +21,7 @@ jobs: runs-on: [ self-hosted, type-cpx52, setup-docker, volume-cache-50GB ] strategy: matrix: - dotnet-version: [ '8.0', '9.0' ] + dotnet-version: [ '8.0', '9.0', '10.0' ] env: NUGET_PACKAGES: "/mnt/cache/.nuget/packages" DOTNET_INSTALL_DIR: "/mnt/cache/.dotnet" @@ -36,6 +36,8 @@ jobs: dotnet-version: | 8.0 9.0 + 10.0 + dotnet-quality: 'preview' - name: Login to Docker Hub if: ${{ github.event.pull_request.head.repo.fork == false }} diff --git a/Directory.Packages.props b/Directory.Packages.props index c66345b6..5bd2b3ee 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,11 +2,17 @@ true + + 10.0.0-rc.2.25502.107 + 10.0.0-rc.2.25502.107 + - 9.0.6 + 9.0.10 + 9.0.10 - 8.0.17 + 8.0.21 + 9.0.10 4.6.0 @@ -18,19 +24,19 @@ - - - - - - - - - - + + + + + + + + + + - + diff --git a/global.json b/global.json new file mode 100644 index 00000000..802ab217 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} \ No newline at end of file diff --git a/src/Core/test/Eventuous.Tests.Subscriptions/RegistrationTests.cs b/src/Core/test/Eventuous.Tests.Subscriptions/RegistrationTests.cs index cdbd0e1a..f13023cc 100644 --- a/src/Core/test/Eventuous.Tests.Subscriptions/RegistrationTests.cs +++ b/src/Core/test/Eventuous.Tests.Subscriptions/RegistrationTests.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging.Abstractions; using Shouldly; using LoggingExtensions = Eventuous.TestHelpers.TUnit.Logging.LoggingExtensions; @@ -17,9 +18,31 @@ namespace Eventuous.Tests.Subscriptions; public class RegistrationTests { - readonly TestServer _server = new(BuildHost()); + TestServer _server = null!; + IHost _host = null!; + readonly ILoggerFactory _logger = LoggingExtensions.GetLoggerFactory(); + [Before(Test)] + public async Task Setup() { + _host = new HostBuilder() + .ConfigureWebHost(webHostBuilder => webHostBuilder + .UseTestServer() + .UseStartup() + ) + .Build(); + await _host.StartAsync(); + + _server = _host.GetTestServer(); + } + + [After(Test)] + public async Task Teardown() { + _server.Dispose(); + await _host.StopAsync(); + _host.Dispose(); + } + [Test] public void ShouldBeSingletons() { var subs1 = _server.Services.GetServices().ToArray(); @@ -105,8 +128,6 @@ public void ShouldRegisterTwoMeasures() { _server.Services.GetRequiredService(); } - static IWebHostBuilder BuildHost() => new WebHostBuilder().UseStartup(); - class Startup { public static void ConfigureServices(IServiceCollection services) { services.AddSingleton(new TestHandlerLogger()); diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7158a66d..8dee96a7 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,6 @@ - net9.0;net8.0 + net10.0;net9.0;net8.0 preview $(NoWarn);CS1591;CS0618; enable @@ -23,12 +23,8 @@ - trx%3bLogFileName=$(MSBuildProjectName).trx - $(RepoRoot)/test-results/$(TargetFramework) false true - true - true true --report-trx --results-directory $(RepoRoot)/test-results/$(TargetFramework) false diff --git a/src/EventStore/src/Eventuous.EventStore/Eventuous.EventStore.csproj b/src/EventStore/src/Eventuous.EventStore/Eventuous.EventStore.csproj index 7093bf50..85ad4866 100644 --- a/src/EventStore/src/Eventuous.EventStore/Eventuous.EventStore.csproj +++ b/src/EventStore/src/Eventuous.EventStore/Eventuous.EventStore.csproj @@ -14,6 +14,9 @@ + + + diff --git a/src/EventStore/test/Eventuous.Tests.EventStore/Eventuous.Tests.EventStore.csproj b/src/EventStore/test/Eventuous.Tests.EventStore/Eventuous.Tests.EventStore.csproj index b10fed8b..39039de1 100644 --- a/src/EventStore/test/Eventuous.Tests.EventStore/Eventuous.Tests.EventStore.csproj +++ b/src/EventStore/test/Eventuous.Tests.EventStore/Eventuous.Tests.EventStore.csproj @@ -10,16 +10,19 @@ - + - + + + + diff --git a/src/Gateway/test/Eventuous.Tests.Gateway/RegistrationTests.cs b/src/Gateway/test/Eventuous.Tests.Gateway/RegistrationTests.cs index 0fdd69cb..ddb6b085 100644 --- a/src/Gateway/test/Eventuous.Tests.Gateway/RegistrationTests.cs +++ b/src/Gateway/test/Eventuous.Tests.Gateway/RegistrationTests.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging.Abstractions; // ReSharper disable ClassNeverInstantiated.Local @@ -15,12 +16,18 @@ namespace Eventuous.Tests.Gateway; public class RegistrationTests { [Test] - public void Test() { - TestServer host = new(BuildHost()); - host.Dispose(); - } + public async Task Test() { + using var host = new HostBuilder() + .ConfigureWebHost(webHostBuilder => webHostBuilder + .UseTestServer() + .UseStartup() + ) + .Build(); + await host.StartAsync(); - static IWebHostBuilder BuildHost() => new WebHostBuilder().UseStartup(); + var testServer = host.GetTestServer(); + testServer.Dispose(); + } class Startup { public static void ConfigureServices(IServiceCollection services) { diff --git a/src/Postgres/src/Eventuous.Postgresql/Eventuous.Postgresql.csproj b/src/Postgres/src/Eventuous.Postgresql/Eventuous.Postgresql.csproj index 763055bb..36021140 100644 --- a/src/Postgres/src/Eventuous.Postgresql/Eventuous.Postgresql.csproj +++ b/src/Postgres/src/Eventuous.Postgresql/Eventuous.Postgresql.csproj @@ -9,6 +9,8 @@ + + diff --git a/src/Redis/src/Eventuous.Redis/Subscriptions/RedisAllStreamSubscription.cs b/src/Redis/src/Eventuous.Redis/Subscriptions/RedisAllStreamSubscription.cs index 517f1160..e88fe936 100644 --- a/src/Redis/src/Eventuous.Redis/Subscriptions/RedisAllStreamSubscription.cs +++ b/src/Redis/src/Eventuous.Redis/Subscriptions/RedisAllStreamSubscription.cs @@ -28,12 +28,12 @@ protected override async Task ReadEvents(IDatabase database, lo var stream = linkEvent[EventuousRedisKeys.Stream]; var streamPosition = linkEvent[Position]; - var streamEvents = await database.StreamRangeAsync(new RedisKey(stream), streamPosition).NoContext(); + var streamEvents = await database.StreamRangeAsync(new(stream), streamPosition).NoContext(); var entry = streamEvents[0]; persistentEvents.Add( - new ReceivedEvent( - Guid.Parse(entry[MessageId]!), + new( + Guid.Parse(entry[MessageId].ToString()), entry[MessageType]!, entry.Id.ToLong(), entry.Id.ToLong(), diff --git a/src/Redis/src/Eventuous.Redis/Subscriptions/RedisStreamSubscription.cs b/src/Redis/src/Eventuous.Redis/Subscriptions/RedisStreamSubscription.cs index 9913ea15..60590381 100644 --- a/src/Redis/src/Eventuous.Redis/Subscriptions/RedisStreamSubscription.cs +++ b/src/Redis/src/Eventuous.Redis/Subscriptions/RedisStreamSubscription.cs @@ -30,7 +30,7 @@ protected override async Task ReadEvents(IDatabase database, lo return events.Select( evt => new ReceivedEvent( - Guid.Parse(evt[MessageId]!), + Guid.Parse(evt[MessageId].ToString()), evt[MessageType]!, evt.Id.ToLong(), evt.Id.ToLong(), diff --git a/src/Relational/src/Eventuous.Sql.Base/Eventuous.Sql.Base.csproj b/src/Relational/src/Eventuous.Sql.Base/Eventuous.Sql.Base.csproj index 9f5a6aef..8ebeb15d 100644 --- a/src/Relational/src/Eventuous.Sql.Base/Eventuous.Sql.Base.csproj +++ b/src/Relational/src/Eventuous.Sql.Base/Eventuous.Sql.Base.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs b/src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs index 75a5b1a5..30a342db 100644 --- a/src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs +++ b/src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs @@ -139,7 +139,6 @@ StreamEvent ToStreamEvent(PersistedEvent evt) { FailedToDeserialize failed => throw new SerializationException($"Can't deserialize {evt.MessageType}: {failed.Error}"), _ => throw new("Unknown deserialization result") }; - StreamEvent AsStreamEvent(object payload) => new(evt.MessageId, payload, meta ?? new Metadata(), ContentType, evt.StreamPosition); } diff --git a/src/SqlServer/src/Eventuous.SqlServer/Eventuous.SqlServer.csproj b/src/SqlServer/src/Eventuous.SqlServer/Eventuous.SqlServer.csproj index 7fd7b604..1ad690fb 100644 --- a/src/SqlServer/src/Eventuous.SqlServer/Eventuous.SqlServer.csproj +++ b/src/SqlServer/src/Eventuous.SqlServer/Eventuous.SqlServer.csproj @@ -7,10 +7,12 @@ - + + +