Skip to content

Commit

Permalink
Merge pull request #875 from Kladzey/fix-InMemoryReadStore-break
Browse files Browse the repository at this point in the history
Fix InMemoryReadStore.UpdateAsync break
  • Loading branch information
rasmus authored Jun 17, 2021
2 parents ec40468 + 18d8fda commit ef1d038
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### New in 0.82 (not released yet)

* Fix: Source IDs are now added to snapshots
* Fix: InMemoryReadStore will not break on unmodified update result

### New in 0.81.4483 (released 2020-12-14)

Expand Down
19 changes: 19 additions & 0 deletions Source/EventFlow.TestHelpers/Suites/TestSuiteForReadModelStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,25 @@ public async Task RePopulateHandlesManyAggregates()
readModel1.PingsReceived.Should().Be(3);
readModel2.PingsReceived.Should().Be(5);
}

[Test]
public async Task RePopulateHandlesDeletedAggregate()
{
// Arrange
var id1 = ThingyId.New;
var id2 = ThingyId.New;
await PublishPingCommandsAsync(id1, 3).ConfigureAwait(false);
await PublishPingCommandsAsync(id2, 5).ConfigureAwait(false);

// Act
await ReadModelPopulator.DeleteAsync(id2.Value, ReadModelType, CancellationToken.None).ConfigureAwait(false);
await ReadModelPopulator.PopulateAsync(ReadModelType, CancellationToken.None).ConfigureAwait(false);

// Assert
var readModel = await QueryProcessor.ProcessAsync(new ThingyGetQuery(id2)).ConfigureAwait(false);

readModel.PingsReceived.Should().Be(5);
}

[Test]
public async Task PopulateCreatesReadModels()
Expand Down
2 changes: 1 addition & 1 deletion Source/EventFlow/ReadStores/InMemory/InMemoryReadStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public override async Task UpdateAsync(IReadOnlyCollection<ReadModelUpdate> read
.ConfigureAwait(false);
if (!readModelUpdateResult.IsModified)
{
return;
continue;
}

readModelEnvelope = readModelUpdateResult.Envelope;
Expand Down

0 comments on commit ef1d038

Please sign in to comment.