From 612cc4bac36ece17e9b444a7a377aed7570752a6 Mon Sep 17 00:00:00 2001 From: Rasmus Mikkelsen Date: Tue, 7 Sep 2021 20:46:34 +0200 Subject: [PATCH] Add missing test cases for previous_source_ids --- .../UnitTests/Snapshots/SnapshotMetadataTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/EventFlow.Tests/UnitTests/Snapshots/SnapshotMetadataTests.cs b/Source/EventFlow.Tests/UnitTests/Snapshots/SnapshotMetadataTests.cs index b6fcab91f..a25b9c1c6 100644 --- a/Source/EventFlow.Tests/UnitTests/Snapshots/SnapshotMetadataTests.cs +++ b/Source/EventFlow.Tests/UnitTests/Snapshots/SnapshotMetadataTests.cs @@ -21,6 +21,8 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +using System.Linq; +using EventFlow.Core; using EventFlow.Snapshots; using EventFlow.TestHelpers; using EventFlow.TestHelpers.Extensions; @@ -44,6 +46,7 @@ public void DeserializesCorrectly() aggregate_sequence_number = "42", snapshot_name = "thingy", snapshot_version = "84", + previous_source_ids = "cool,magic," }.ToJson(); // Act @@ -55,6 +58,7 @@ public void DeserializesCorrectly() snapshotMetadata.AggregateSequenceNumber.Should().Be(42); snapshotMetadata.SnapshotName.Should().Be("thingy"); snapshotMetadata.SnapshotVersion.Should().Be(84); + snapshotMetadata.PreviousSourceIds.Select(s => s.Value).Should().BeEquivalentTo("cool", "magic"); } [Test] @@ -68,6 +72,11 @@ public void GettersAndSettersWork() AggregateSequenceNumber = 42, SnapshotName = "thingy", SnapshotVersion = 84, + PreviousSourceIds = new [] + { + new SourceId("cool"), + new SourceId("magic") + } }; // Act @@ -80,6 +89,7 @@ public void GettersAndSettersWork() deserializedSnapshotMetadata.AggregateSequenceNumber.Should().Be(42); deserializedSnapshotMetadata.SnapshotName.Should().Be("thingy"); deserializedSnapshotMetadata.SnapshotVersion.Should().Be(84); + deserializedSnapshotMetadata.PreviousSourceIds.Select(s => s.Value).Should().BeEquivalentTo("cool", "magic"); } [Test]