public async Task RehydrateState_fails_if_state_not_exists( IStateRehydrator <State1> rehydrator, Guid streamId) { Mock.Get(rehydrator).Setup(x => x.TryRehydrateState(streamId)).ReturnsAsync(default(State1)); Func <Task> action = () => rehydrator.RehydrateState(streamId); await action.Should().ThrowAsync <InvalidOperationException>(); }
public async Task RehydrateState_returns_state_correctly( IStateRehydrator <State1> rehydrator, Guid streamId, State1 state) { Mock.Get(rehydrator).Setup(x => x.TryRehydrateState(streamId)).ReturnsAsync(state); State1 actual = await rehydrator.RehydrateState(streamId); actual.Should().BeSameAs(state); }
public async Task TakeSnapshot(Guid streamId) { T state = await _rehydrator.RehydrateState(streamId).ConfigureAwait(continueOnCapturedContext: false); CloudBlockBlob blob = GetBlobReference(streamId); await SetContent(blob, state).ConfigureAwait(continueOnCapturedContext: false); await SetProperties(blob).ConfigureAwait(continueOnCapturedContext: false); }