public async Task OldSnapshotsAreUpgradedToLatestVersionAndAppliedToAggregate()
        {
            // Arrange
            var thingyId         = A <ThingyId>();
            var pingIds          = Many <PingId>();
            var expectedVersion  = pingIds.Count;
            var thingySnapshotV1 = new ThingySnapshotV1(pingIds);

            await StoreSnapshotAsync(thingyId, expectedVersion, thingySnapshotV1).ConfigureAwait(false);

            // Act
            var thingyAggregate = await LoadAggregateAsync(thingyId).ConfigureAwait(false);

            // Assert
            thingyAggregate.Version.Should().Be(expectedVersion);
            thingyAggregate.PingsReceived.ShouldAllBeEquivalentTo(pingIds);
            thingyAggregate.SnapshotVersions.Should().Contain(new[] { ThingySnapshotVersion.Version1, ThingySnapshotVersion.Version2 });
        }
        public async Task OldSnapshotsAreUpgradedToLatestVersionAndHaveCorrectMetadata()
        {
            // Arrange
            var thingyId         = A <ThingyId>();
            var pingIds          = Many <PingId>();
            var expectedVersion  = pingIds.Count;
            var thingySnapshotV1 = new ThingySnapshotV1(pingIds);

            await StoreSnapshotAsync(thingyId, expectedVersion, thingySnapshotV1).ConfigureAwait(false);

            // Act
            var snapshotContainer = await SnapshotStore.LoadSnapshotAsync <ThingyAggregate, ThingyId, ThingySnapshot>(
                thingyId,
                CancellationToken.None)
                                    .ConfigureAwait(false);

            // Assert
            snapshotContainer.Snapshot.Should().BeOfType <ThingySnapshot>();
            snapshotContainer.Metadata.AggregateId.Should().Be(thingyId.Value);
            snapshotContainer.Metadata.AggregateName.Should().Be("ThingyAggregate");
            snapshotContainer.Metadata.AggregateSequenceNumber.Should().Be(expectedVersion);
            snapshotContainer.Metadata.SnapshotName.Should().Be("thingy");
            snapshotContainer.Metadata.SnapshotVersion.Should().Be(1);
        }