// Hydrating internal void Hydrate(IEnumerable <Event> events) { foreach (var @event in events) { aggregate.ApplyEvent(@event.Replay()); } aggregate.ClearPendingEvents(); LastCommittedVersion = CurrentVersion; }
public void Init() { Aggregate = CreateAggregate(); var domainEvents = Given().ToList(); if (domainEvents.Any()) { foreach (var e in domainEvents) { Aggregate.ApplyEvent(e); } ClearUncommittedEvents(); } When(); }