public async Task TryRestoreSnapshot_restores_snapshot_correctly_if_it_exists() { // Arrange BlobSnapshotReader <State> sut = GenerateSut(); var streamId = Guid.NewGuid(); State state = new Fixture().Create <State>(); IStateRehydrator <State> rehydrator = Mock.Of <IStateRehydrator <State> >(); Mock.Get(rehydrator) .Setup(x => x.TryRehydrateState(streamId)) .ReturnsAsync(state); var snapshotter = new BlobSnapshotter <State>( rehydrator, JsonProcessor, SnapshotContainer); await snapshotter.TakeSnapshot(streamId); // Act State actual = await sut.TryRestoreSnapshot(streamId); // Assert actual.Should().BeEquivalentTo(state); }
public async Task TryRestoreSnapshot_returns_null_if_snapshot_not_exists() { BlobSnapshotReader <State> sut = GenerateSut(); var streamId = Guid.NewGuid(); State actual = await sut.TryRestoreSnapshot(streamId); actual.Should().BeNull(); }