public async Task LoadAsync_WhenTheStateDoesNotExists_ReturnsEmptyVersion(TodoTaskId id) { // act var(version, _) = await _stateStorage.LoadAsync <TodoTask.AggregateState>(id, CancellationToken.None); // assert Assert.True(AggregateVersion.IsEmpty(version)); }
/// <inheritdoc /> public virtual async Task <TAggregateRoot> FindByIdAsync(TEntityId id, CancellationToken cancellationToken) { Require.NotNull(id, nameof(id)); var(version, state) = await _stateStorage.LoadAsync <TAggregateState>(id, cancellationToken); if (version == AggregateVersion.Emtpy) { return(null); } return(CreateAggregateInstance(id, version, state)); }