From ab86f2361b50299f21abc4b9823fa83d9cebaad3 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Wed, 18 Mar 2026 02:49:11 +0700 Subject: [PATCH] Remove FluentAssertions from Akka.Persistence.TCK and Akka.Persistence.TCK.Xunit2 --- .../Akka.Persistence.TCK.Xunit2.csproj | 1 - .../Akka.Persistence.TCK.csproj | 1 - .../Query/CurrentEventsByPersistenceIdSpec.cs | 7 +++--- .../Query/CurrentEventsByTagSpec.cs | 15 ++++++------ .../Query/EventsByPersistenceIdSpec.cs | 5 ++-- .../Query/EventsByTagSpec.cs | 11 ++++----- .../Query/PersistenceIdsSpec.cs | 3 +-- .../SnapshotStoreSerializationSpec.cs | 1 - .../Snapshot/SnapshotStoreSaveSnapshotSpec.cs | 24 +++++++++---------- .../Snapshot/SnapshotStoreSpec.cs | 4 +--- 10 files changed, 30 insertions(+), 42 deletions(-) diff --git a/src/core/Akka.Persistence.TCK.Xunit2/Akka.Persistence.TCK.Xunit2.csproj b/src/core/Akka.Persistence.TCK.Xunit2/Akka.Persistence.TCK.Xunit2.csproj index c94d749a675..61c09eb307e 100644 --- a/src/core/Akka.Persistence.TCK.Xunit2/Akka.Persistence.TCK.Xunit2.csproj +++ b/src/core/Akka.Persistence.TCK.Xunit2/Akka.Persistence.TCK.Xunit2.csproj @@ -15,7 +15,6 @@ - diff --git a/src/core/Akka.Persistence.TCK/Akka.Persistence.TCK.csproj b/src/core/Akka.Persistence.TCK/Akka.Persistence.TCK.csproj index 242acaa6116..d894a58f0c0 100644 --- a/src/core/Akka.Persistence.TCK/Akka.Persistence.TCK.csproj +++ b/src/core/Akka.Persistence.TCK/Akka.Persistence.TCK.csproj @@ -15,7 +15,6 @@ - diff --git a/src/core/Akka.Persistence.TCK/Query/CurrentEventsByPersistenceIdSpec.cs b/src/core/Akka.Persistence.TCK/Query/CurrentEventsByPersistenceIdSpec.cs index a6d12016ccb..d8516c1c098 100644 --- a/src/core/Akka.Persistence.TCK/Query/CurrentEventsByPersistenceIdSpec.cs +++ b/src/core/Akka.Persistence.TCK/Query/CurrentEventsByPersistenceIdSpec.cs @@ -15,7 +15,6 @@ using Akka.Streams.Dsl; using Akka.Streams.TestKit; using Akka.Util.Internal; -using FluentAssertions; using Xunit; namespace Akka.Persistence.TCK.Query @@ -199,9 +198,9 @@ public void ReadJournal_CurrentEventsByPersistenceId_should_include_timestamp_in var probe = src.RunWith(this.SinkProbe(), Materializer); probe.Request(5); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); + Assert.True( probe.ExpectNext().Timestamp > 0 ); + Assert.True( probe.ExpectNext().Timestamp > 0 ); + Assert.True( probe.ExpectNext().Timestamp > 0 ); probe.ExpectComplete(); } diff --git a/src/core/Akka.Persistence.TCK/Query/CurrentEventsByTagSpec.cs b/src/core/Akka.Persistence.TCK/Query/CurrentEventsByTagSpec.cs index 1641475b256..cedf1aa96a0 100644 --- a/src/core/Akka.Persistence.TCK/Query/CurrentEventsByTagSpec.cs +++ b/src/core/Akka.Persistence.TCK/Query/CurrentEventsByTagSpec.cs @@ -14,7 +14,6 @@ using Akka.Streams; using Akka.Streams.TestKit; using Akka.Streams.Dsl; -using FluentAssertions; using Xunit; using Xunit.Sdk; using static Akka.Persistence.Query.Offset; @@ -244,8 +243,8 @@ public virtual void ReadJournal_query_CurrentEventsByTag_should_include_timestam var greenSrc = queries.CurrentEventsByTag("green", offset: NoOffset()); var probe = greenSrc.RunWith(this.SinkProbe(), Materializer); probe.Request(2); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); + Assert.True( probe.ExpectNext().Timestamp > 0 ); + Assert.True( probe.ExpectNext().Timestamp > 0 ); probe.Cancel(); } @@ -267,13 +266,13 @@ private void WaitForTagEvents(ICurrentEventsByTagQuery queries, string tag, int private EventEnvelope ExpectEnvelope(TestSubscriber.Probe probe, string persistenceId, long sequenceNr, string @event, string tag) { var envelope = probe.ExpectNext(_ => true); - envelope.PersistenceId.Should().Be(persistenceId); - envelope.SequenceNr.Should().Be(sequenceNr); - envelope.Event.Should().Be(@event); + Assert.Equal(persistenceId, envelope.PersistenceId); + Assert.Equal(sequenceNr, envelope.SequenceNr); + Assert.Equal(@event, envelope.Event); if (SupportsTagsInEventEnvelope) { - envelope.Tags.Should().NotBeNull(); - envelope.Tags.Should().Contain(tag); + Assert.NotNull(envelope.Tags); + Assert.Contains(tag, envelope.Tags); } return envelope; } diff --git a/src/core/Akka.Persistence.TCK/Query/EventsByPersistenceIdSpec.cs b/src/core/Akka.Persistence.TCK/Query/EventsByPersistenceIdSpec.cs index fbfc7030e74..23714acd18a 100644 --- a/src/core/Akka.Persistence.TCK/Query/EventsByPersistenceIdSpec.cs +++ b/src/core/Akka.Persistence.TCK/Query/EventsByPersistenceIdSpec.cs @@ -15,7 +15,6 @@ using Akka.Streams.Dsl; using Akka.Streams.TestKit; using Akka.Util.Internal; -using FluentAssertions; using Xunit; namespace Akka.Persistence.TCK.Query @@ -103,8 +102,8 @@ public void ReadJournal_live_query_EventsByPersistenceId_should_include_timestam var probe = src.RunWith(this.SinkProbe(), Materializer); probe.Request(5); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); - probe.ExpectNext().Timestamp.Should().BeGreaterThan(0); + Assert.True( probe.ExpectNext().Timestamp > 0 ); + Assert.True( probe.ExpectNext().Timestamp > 0 ); probe.Cancel(); } diff --git a/src/core/Akka.Persistence.TCK/Query/EventsByTagSpec.cs b/src/core/Akka.Persistence.TCK/Query/EventsByTagSpec.cs index 0d76090021f..8d0dc3e0da4 100644 --- a/src/core/Akka.Persistence.TCK/Query/EventsByTagSpec.cs +++ b/src/core/Akka.Persistence.TCK/Query/EventsByTagSpec.cs @@ -12,7 +12,6 @@ using Akka.Streams; using Akka.Streams.TestKit; using Akka.TestKit; -using FluentAssertions; using Xunit; using Xunit.Sdk; using static Akka.Persistence.Query.Offset; @@ -114,13 +113,13 @@ public virtual void ReadJournal_live_query_EventsByTag_should_find_events_from_o private EventEnvelope ExpectEnvelope(TestSubscriber.Probe probe, string persistenceId, long sequenceNr, string @event, string tag) { var envelope = probe.ExpectNext(_ => true); - envelope.PersistenceId.Should().Be(persistenceId); - envelope.SequenceNr.Should().Be(sequenceNr); - envelope.Event.Should().Be(@event); + Assert.Equal(persistenceId, envelope.PersistenceId); + Assert.Equal(sequenceNr, envelope.SequenceNr); + Assert.Equal(@event, envelope.Event); if (SupportsTagsInEventEnvelope) { - envelope.Tags.Should().NotBeNull(); - envelope.Tags.Should().Contain(tag); + Assert.NotNull(envelope.Tags); + Assert.Contains(tag, envelope.Tags); } return envelope; } diff --git a/src/core/Akka.Persistence.TCK/Query/PersistenceIdsSpec.cs b/src/core/Akka.Persistence.TCK/Query/PersistenceIdsSpec.cs index 0fcb5f75efe..be29af7f1c3 100644 --- a/src/core/Akka.Persistence.TCK/Query/PersistenceIdsSpec.cs +++ b/src/core/Akka.Persistence.TCK/Query/PersistenceIdsSpec.cs @@ -17,7 +17,6 @@ using Akka.Streams.TestKit; using Akka.TestKit; using Akka.Util.Internal; -using FluentAssertions; using Reactive.Streams; using Xunit; @@ -80,7 +79,7 @@ public virtual void ReadJournal_AllPersistenceIds_should_find_new_events_after_d var expected = new List { "h", "i", "j" }; probe.Within(TimeSpan.FromSeconds(10), () => { - expected.Remove(probe.Request(1).ExpectNext()).Should().BeTrue(); + Assert.True(expected.Remove(probe.Request(1).ExpectNext())); return probe.ExpectNoMsg(TimeSpan.FromMilliseconds(500)); }); diff --git a/src/core/Akka.Persistence.TCK/Serialization/SnapshotStoreSerializationSpec.cs b/src/core/Akka.Persistence.TCK/Serialization/SnapshotStoreSerializationSpec.cs index 36187a30da8..88ca5ecf337 100644 --- a/src/core/Akka.Persistence.TCK/Serialization/SnapshotStoreSerializationSpec.cs +++ b/src/core/Akka.Persistence.TCK/Serialization/SnapshotStoreSerializationSpec.cs @@ -14,7 +14,6 @@ using Akka.Serialization; using Xunit; using Akka.Util.Internal; -using FluentAssertions; #nullable enable namespace Akka.Persistence.TCK.Serialization diff --git a/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSaveSnapshotSpec.cs b/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSaveSnapshotSpec.cs index a633fa651e3..bb2956ee4c5 100644 --- a/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSaveSnapshotSpec.cs +++ b/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSaveSnapshotSpec.cs @@ -14,8 +14,6 @@ using Akka.Persistence.Snapshot; using Akka.Persistence.TCK.Serialization; using Akka.TestKit; -using FluentAssertions; -using FluentAssertions.Extensions; using Xunit; namespace Akka.Persistence.TCK.Snapshot; @@ -89,8 +87,8 @@ public virtual async Task MultipleSnapshotsWithNoPersistTest() var result = await SenderProbe.ExpectMsgAsync(); await StopActorAsync(persistenceActor); - result.Length.Should().Be(1, $"expecting an array with length 1 (on iteration {iteration}/{RepeatCount})"); - result[0].Should().Be(3, $"recovered snapshot should be the last snapshot (on iteration {iteration}/{RepeatCount})"); + Assert.Single(result); // expecting an array with length 1 + Assert.Equal(3, result[0]); // recovered snapshot should be the last snapshot Output.WriteLine($"Iteration: {iteration}"); } @@ -124,8 +122,8 @@ public virtual async Task MultipleSnapshotsWithPersistTest() var result = await SenderProbe.ExpectMsgAsync(); await StopActorAsync(persistenceActor); - result.Length.Should().Be(1, $"expecting an array with length 1 (on iteration {iteration}/{RepeatCount})"); - result[0].Should().Be(3, $"recovered snapshot should be the last snapshot (on iteration {iteration}/{RepeatCount})"); + Assert.Single(result); // expecting an array with length 1 + Assert.Equal(3, result[0]); // recovered snapshot should be the last snapshot Output.WriteLine($"Iteration: {iteration}"); } @@ -140,17 +138,17 @@ public virtual async Task MultipleSnapshotsWithSameSeqNo() var metadata = new SnapshotMetadata(PersistenceId, 3, DateTime.UtcNow); snapshotStore.Tell(new SaveSnapshot(metadata, snap), SenderProbe); - var success = await SenderProbe.ExpectMsgAsync(10.Minutes()); - success.Metadata.PersistenceId.Should().Be(metadata.PersistenceId); - success.Metadata.Timestamp.Should().Be(metadata.Timestamp); - success.Metadata.SequenceNr.Should().Be(metadata.SequenceNr); + var success = await SenderProbe.ExpectMsgAsync(TimeSpan.FromMinutes(10)); + Assert.Equal(success.Metadata.PersistenceId, metadata.PersistenceId); + Assert.Equal(success.Metadata.Timestamp, metadata.Timestamp); + Assert.Equal(success.Metadata.SequenceNr, metadata.SequenceNr); metadata = new SnapshotMetadata(PersistenceId, 3, DateTime.UtcNow); snapshotStore.Tell(new SaveSnapshot(metadata, 3), SenderProbe); success = await SenderProbe.ExpectMsgAsync(); - success.Metadata.PersistenceId.Should().Be(metadata.PersistenceId); - success.Metadata.Timestamp.Should().Be(metadata.Timestamp); - success.Metadata.SequenceNr.Should().Be(metadata.SequenceNr); + Assert.Equal(success.Metadata.PersistenceId, metadata.PersistenceId); + Assert.Equal(success.Metadata.Timestamp, metadata.Timestamp); + Assert.Equal(success.Metadata.SequenceNr, metadata.SequenceNr); } #region Utility diff --git a/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSpec.cs b/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSpec.cs index 45cd08108fe..91f3a3a5b07 100644 --- a/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSpec.cs +++ b/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSpec.cs @@ -14,8 +14,6 @@ using Akka.Persistence.Fsm; using Akka.Persistence.TCK.Serialization; using Akka.TestKit; -using FluentAssertions; -using FluentAssertions.Extensions; using Xunit; namespace Akka.Persistence.TCK.Snapshot @@ -234,7 +232,7 @@ public virtual void SnapshotStore_should_not_delete_snapshot_identified_by_Seque { var md = Metadata[2]; // timestamp argument is less than the actual metadata data stored in the database, no deletion occured - md = new SnapshotMetadata(md.PersistenceId, md.SequenceNr, md.Timestamp - 2.Seconds()); + md = new SnapshotMetadata(md.PersistenceId, md.SequenceNr, md.Timestamp - TimeSpan.FromSeconds(2)); var command = new DeleteSnapshot(md); var sub = CreateTestProbe();