public async Task GetSnapshotAsync_ExistingIdWithPastSnapshot_OnlyRelevantEventsApplied() { var eventStore = _dbContext.Persons.Add(new PersonEventStore { Id = 12 }).Entity; eventStore.Events.Add(new PersonEvent { SerializedEvent = "{" + "\"$type\": \"Silverback.Tests.EventSourcing.TestTypes.Person+NameChangedEvent, Silverback.EventSourcing.Tests\"," + "\"NewName\": \"Silverback\"" + "}", Timestamp = DateTime.Parse("2000-05-05") }); eventStore.Events.Add(new PersonEvent { SerializedEvent = "{" + "\"$type\": \"Silverback.Tests.EventSourcing.TestTypes.Person+NameChangedEvent, Silverback.EventSourcing.Tests\"," + "\"NewName\": \"Sergio\"" + "}", Timestamp = DateTime.Parse("2000-03-01") }); eventStore.Events.Add(new PersonEvent { SerializedEvent = "{" + "\"$type\": \"Silverback.Tests.EventSourcing.TestTypes.Person+AgeChangedEvent, Silverback.EventSourcing.Tests\"," + "\"NewAge\": 16" + "}", Timestamp = DateTime.Parse("2000-02-01") }); eventStore.Events.Add(new PersonEvent { SerializedEvent = "{" + "\"$type\": \"Silverback.Tests.EventSourcing.TestTypes.Person+AgeChangedEvent, Silverback.EventSourcing.Tests\"," + "\"NewAge\": 35" + "}", Timestamp = DateTime.Parse("2019-07-06") }); _dbContext.SaveChanges(); var repo = new PersonDbEventStoreRepository(new EfCoreDbContext <TestDbContext>(_dbContext)); var entity = await repo.GetSnapshotAsync(p => p.Id == 12, DateTime.Parse("2000-03-01")); entity.Name.Should().Be("Sergio"); entity.Age.Should().Be(16); }