Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>
<PropertyGroup>
<NpgsqlVersion>9.0.3</NpgsqlVersion>
<TUnitVersion>0.25.21</TUnitVersion>
<TUnitVersion>0.77.3</TUnitVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
Expand All @@ -33,7 +33,7 @@
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="9.0.6" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
<PackageVersion Include="EventStore.Client.Grpc.PersistentSubscriptions" Version="23.3.9" />
<PackageVersion Include="EventStore.Client.Grpc.Streams" Version="23.3.9" />
<PackageVersion Include="MongoDB.Driver" Version="3.4.0" />
Expand Down Expand Up @@ -84,21 +84,21 @@
<PackageVersion Include="TUnit" Version="$(TUnitVersion)" />
<PackageVersion Include="TUnit.Core" Version="$(TUnitVersion)" />
<PackageVersion Include="TUnit.Assertions" Version="$(TUnitVersion)" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.7.3" />
<PackageVersion Include="Verify.TUnit" Version="30.4.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.0.1" />
<PackageVersion Include="Verify.TUnit" Version="31.0.5" />
<PackageVersion Include="NodaTime.Bogus" Version="3.0.2" />
<PackageVersion Include="System.Text.Json" Version="9.0.6" />
</ItemGroup>
<ItemGroup Label="Packages for samples">
<PackageVersion Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.1.0" />
<PackageVersion Include="MongoDB.Driver.Core" Version="2.30.0" />
<PackageVersion Include="Npgsql.OpenTelemetry" Version="$(NpgsqlVersion)" />
<PackageVersion Include="OpenTelemetry" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
<PackageVersion Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.10.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Exporter.Zipkin" Version="1.12.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.9.0-beta.1" />
<PackageVersion Include="OpenTelemetry" Version="1.13.1" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.13.1" />
<PackageVersion Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.13.1-beta.1" />
<PackageVersion Include="OpenTelemetry.Exporter.Zipkin" Version="1.13.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.13.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.13.0-beta.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ public class TopicAndQueueSourceAttribute : DataSourceGeneratorAttribute<AzureSe
const string QueueName = "queue.1";
const string TopicName = "topic.1";

/// <summary>
/// This is strange. The 'subscription.1' in the emulator has a content type filter. We populate
/// the content type, but it still gets filtered out. So we use 'subscription.3,' which has no filters.
/// </summary>
// This is strange. The 'subscription.1' in the emulator has a content type filter. We populate
// the content type, but it still gets filtered out. So we use 'subscription.3,' which has no filters.
const string SubscriptionName = "subscription.3";

readonly ClassDataSourceAttribute<AzureServiceBusFixture> _fixtureDataSource = new() {
Shared = SharedType.PerTestSession
};
static readonly Lazy<AzureServiceBusFixture> FixtureInstance = new(() => new());

public override IEnumerable<Func<(AzureServiceBusFixture, ServiceBusProducerOptions, ServiceBusSubscriptionOptions)>> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata) {
protected override IEnumerable<Func<(AzureServiceBusFixture, ServiceBusProducerOptions, ServiceBusSubscriptionOptions)>> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata) {
yield return () => {
var f = _fixtureDataSource.GenerateDataSources(dataGeneratorMetadata).First()();
var f = FixtureInstance.Value;

return (
f,
Expand All @@ -34,7 +30,7 @@ public class TopicAndQueueSourceAttribute : DataSourceGeneratorAttribute<AzureSe
};

yield return () => {
var f = _fixtureDataSource.GenerateDataSources(dataGeneratorMetadata).First()();
var f = FixtureInstance.Value;

return (
f,
Expand All @@ -49,7 +45,7 @@ public class TopicAndQueueSourceAttribute : DataSourceGeneratorAttribute<AzureSe
};

yield return () => {
var f = _fixtureDataSource.GenerateDataSources(dataGeneratorMetadata).First()();
var f = FixtureInstance.Value;

return (
f,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Eventuous.Sut.Domain;
using Eventuous.Tests.Persistence.Base.Fixtures;
using TUnit.Assertions.AssertConditions.Throws;

namespace Eventuous.Tests.Persistence.Base.Store;

Expand Down Expand Up @@ -48,7 +47,7 @@ public async Task ShouldFailOnWrongVersionNoStream() {

evt = Helpers.CreateEvent();

await Assert.That(() => _fixture.AppendEvent(stream, evt, ExpectedStreamVersion.NoStream)).Throws<AppendToStreamException>();
await Assert.That(() => _fixture.AppendEvent(stream, evt, ExpectedStreamVersion.NoStream)!).Throws<AppendToStreamException>();
}

[Test]
Expand All @@ -61,9 +60,9 @@ public async Task ShouldFailOnWrongVersion() {

evt = Helpers.CreateEvent();

await Assert.That(() => _fixture.AppendEvent(stream, evt, new(3))).Throws<AppendToStreamException>();
await Assert.That(() => _fixture.AppendEvent(stream, evt, new(3))!).Throws<AppendToStreamException>();
}


[Test]
[Category("Store")]
Expand All @@ -75,6 +74,6 @@ public async Task ShouldFailOnWrongVersionWithOptimisticConcurrencyException() {

evt = Helpers.CreateEvent();

await Assert.That(() => _fixture.StoreChanges(stream, evt, new(3))).Throws<OptimisticConcurrencyException>();
await Assert.That(() => _fixture.StoreChanges(stream, evt, new(3))!).Throws<OptimisticConcurrencyException>();
}
}
6 changes: 4 additions & 2 deletions src/Core/test/Eventuous.Tests.Persistence.Base/Store/Read.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public async Task ShouldReadMany(CancellationToken cancellationToken) {
await _fixture.AppendEvents(streamName, events, ExpectedStreamVersion.NoStream);

var result = await _fixture.EventStore.ReadEvents(streamName, StreamReadPosition.Start, 100, true, cancellationToken);
var actual = result.Select(x => x.Payload);

IEnumerable<object> actual = result.Select(x => x.Payload)!;
await Assert.That(actual).IsEquivalentTo(events);
}

Expand Down Expand Up @@ -79,6 +80,7 @@ public async Task ShouldReadMetadata(CancellationToken cancellationToken) {
await Assert.That(result[0].Payload).IsEquivalentTo(evt);

await Assert.That(result[0].Metadata.ToDictionary(m => m.Key, m => ((JsonElement)m.Value!).GetString()))
.ContainsKey("Key1").And.ContainsKey("Key2");
.ContainsKey("Key1")
.And.ContainsKey("Key2");
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Bogus;
using DotNet.Testcontainers.Containers;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.Persistence.Base.Fixtures;
using JetBrains.Annotations;

Expand All @@ -23,7 +22,7 @@ protected async Task Should_load_hot_and_archive() {
var loaded = (await combined.ReadStream(stream, StreamReadPosition.Start)).ToArray();

var actual = loaded.Select(x => (TestEventForTiers)x.Payload!);
await Assert.That(actual).CollectionEquivalentTo(testEvents);
await Assert.That(actual).IsEquivalentTo(testEvents);

await Assert.That(loaded.Take(50).Select(x => x.FromArchive)).DoesNotContain(false);
await Assert.That(loaded.Skip(50).Select(x => x.FromArchive)).DoesNotContain(true);
Expand Down
1 change: 0 additions & 1 deletion src/Core/test/Eventuous.Tests/StreamNameTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Eventuous.Sut.Domain;
using TUnit.Assertions.AssertConditions.Throws;

namespace Eventuous.Tests;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ProjectReference Include="$(DiagRoot)\Eventuous.Diagnostics.Logging\Eventuous.Diagnostics.Logging.csproj"/>
<ProjectReference Include="$(ExtRoot)\Eventuous.Extensions.DependencyInjection\Eventuous.Extensions.DependencyInjection.csproj"/>
<ProjectReference Include="$(LocalRoot)\Eventuous.EventStore\Eventuous.EventStore.csproj"/>
<ProjectReference Include="$(SrcRoot)\Core\gen\Eventuous.Shared.Generators\Eventuous.Shared.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="$(CoreTestRoot)\Eventuous.Tests.Persistence.Base\Eventuous.Tests.Persistence.Base.csproj"/>
<ProjectReference Include="$(SrcRoot)\Diagnostics\test\Eventuous.Tests.OpenTelemetry\Eventuous.Tests.OpenTelemetry.csproj"/>
<ProjectReference Include="$(CoreTestRoot)\Eventuous.Tests.Subscriptions.Base\Eventuous.Tests.Subscriptions.Base.csproj"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eventuous.Producers;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.EventStore.Subscriptions.Fixtures;
using Eventuous.Tests.Subscriptions.Base;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eventuous.Producers;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.EventStore.Subscriptions.Fixtures;
using Eventuous.Tests.Subscriptions.Base;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eventuous.Producers;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.EventStore.Subscriptions.Fixtures;
using Eventuous.Tests.Subscriptions.Base;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Eventuous.EventStore.Subscriptions;
using Eventuous.Producers;
using Eventuous.Subscriptions.Filters;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.EventStore.Subscriptions.Fixtures;
using Eventuous.Tests.Subscriptions.Base;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Eventuous.EventStore.Subscriptions;
using Eventuous.Producers;
using Eventuous.Subscriptions.Context;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.Subscriptions.Base;
using Microsoft.Extensions.DependencyInjection;
using StreamSubscription = Eventuous.EventStore.Subscriptions.StreamSubscription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Eventuous.EventStore.Subscriptions;
using Eventuous.Producers;
using Eventuous.Subscriptions.Registrations;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.Subscriptions.Base;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
Expand Down Expand Up @@ -49,7 +50,7 @@
IEnumerable<object> Generate() {
for (var i = 0; i < count; i++) {
yield return new TestEvent(Guid.NewGuid().ToString(), i);
yield return new UnknownEvent(Guid.NewGuid().ToString(), i);

Check warning on line 53 in src/EventStore/test/Eventuous.Tests.EventStore/Subscriptions/SubscriptionIgnoredMessagesTests.cs

View workflow job for this annotation

GitHub Actions / Build and test (9.0)

Event type 'Eventuous.Tests.EventStore.Subscriptions.SubscriptionIgnoredMessagesTests.UnknownEvent' is used as a domain event but isn't annotated with

Check warning on line 53 in src/EventStore/test/Eventuous.Tests.EventStore/Subscriptions/SubscriptionIgnoredMessagesTests.cs

View workflow job for this annotation

GitHub Actions / Build and test (8.0)

Event type 'Eventuous.Tests.EventStore.Subscriptions.SubscriptionIgnoredMessagesTests.UnknownEvent' is used as a domain event but isn't annotated with
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using TestDependency = Eventuous.Tests.DependencyInjection.Sut.TestDependency;
using TestState = Eventuous.Tests.DependencyInjection.Sut.TestState;

namespace Eventuous.Tests.DependencyInjection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public ControllerTests(WebApplicationFactory<Program> factory) {
app.MapCommands<BookingState>().MapCommand<BookRoom>();
}
);

listener = new();
}

[Test]
Expand All @@ -55,9 +53,7 @@ public async Task RecordPaymentUsingMappedCommand(CancellationToken cancellation
last.Payload.ShouldBeEquivalentTo(expected);
}

#pragma warning disable TUnit0023
static TestEventListener? listener;
#pragma warning restore TUnit0023

[After(Class)]
public static void Dispose() => listener?.Dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public async Task RegisterStateCommands() {

var b = app.MapDiscoveredCommands<BookingState>();

var actual = b.DataSources.First().Endpoints.Select(x => x.DisplayName).Order().ToList();
IEnumerable<string> actual = b.DataSources.First().Endpoints.Select(x => x.DisplayName).Order().ToList()!;

var expected = new[] { "HTTP: POST nested-book", "HTTP: POST import2" };

await Assert.That(actual).IsEquivalentTo(expected.Order());
Expand All @@ -30,7 +31,8 @@ public async Task RegisterStatesCommands() {

var b = app.MapDiscoveredCommands(typeof(TestCommands.DuplicateCommand));

var actual = b.DataSources.First().Endpoints.Select(x => x.DisplayName).Order().ToList();
IEnumerable<string> actual = b.DataSources.First().Endpoints.Select(x => x.DisplayName).Order().ToList()!;

var expected = new[] { "HTTP: POST nested-book", "HTTP: POST import2", "HTTP: POST import-wrong" };

await Assert.That(actual).IsEquivalentTo(expected.Order());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task SubscribeAndProduce(CancellationToken cancellationToken) {

await _producer.Produce(_pubsubTopic, testEvent, null, cancellationToken: cancellationToken);

await _handler.AssertThat().Timebox(10.Seconds()).Any().Match(x => x as TestEvent == testEvent).Validate(cancellationToken);
await _handler.AssertThat().Timebox(TimeSpan.FromSeconds(10)).Any().Match(x => x as TestEvent == testEvent).Validate(cancellationToken);
}

[Test]
Expand All @@ -63,7 +63,7 @@ public async Task SubscribeAndProduceMany(CancellationToken cancellationToken) {
var testEvents = TestEvent.CreateMany(count);

await _producer.Produce(_pubsubTopic, testEvents, null, cancellationToken: cancellationToken);
await _handler.AssertCollection(40.Seconds(), [..testEvents]).Validate(cancellationToken);
await _handler.AssertCollection(TimeSpan.FromSeconds(40), [..testEvents]).Validate(cancellationToken);
}

[Before(Test)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task TestContextConversion(IMessageConsumeContext context, Type exp

var typed = MessageConsumeContextConverter.RegisteredConverters[0].Invoke(context);
await Assert.That(typed).IsNotNull();
await Assert.That(typed).IsAssignableTo(expectedType);
await Assert.That(typed.GetType().IsAssignableTo(expectedType)).IsTrue();
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ public async Task ShouldMeasureSubscriptionGapCountBase_Postgres() {
await ShouldMeasureSubscriptionGapCountBase();
}
}

4 changes: 2 additions & 2 deletions src/Redis/test/Eventuous.Tests.Redis/Store/Read.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task ShouldReadMany(CancellationToken cancellationToken) {

var result = await fixture.EventReader.ReadEvents(streamName, StreamReadPosition.Start, 100, true, cancellationToken);

var actual = result.Select(x => x.Payload);
IEnumerable<object> actual = result.Select(x => x.Payload)!;
await Assert.That(actual).IsEquivalentTo(events);
}

Expand All @@ -45,7 +45,7 @@ public async Task ShouldReadTail(CancellationToken cancellationToken) {

var result = await fixture.EventReader.ReadEvents(streamName, new((long)position), 100, true, cancellationToken);

var actual = result.Select(x => x.Payload);
IEnumerable<object> actual = result.Select(x => x.Payload)!;
await Assert.That(actual).IsEquivalentTo(events2);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eventuous.Subscriptions.Logging;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.Redis.Fixtures;
using Eventuous.Tests.Subscriptions.Base;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eventuous.Subscriptions.Logging;
using Eventuous.TestHelpers.TUnit;
using Eventuous.Tests.Redis.Fixtures;
using Eventuous.Tests.Subscriptions.Base;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Eventuous.Subscriptions.Filters;
using Microsoft.Data.SqlClient;
using System.Data;
using TUnit.Assertions.AssertConditions.Throws;

namespace Eventuous.Tests.SqlServer.Subscriptions;

Expand Down
54 changes: 0 additions & 54 deletions test/Eventuous.TestHelpers.TUnit/Assertions.cs

This file was deleted.

Loading
Loading