public async Task Should_write_state_and_events_when_saved() { await sut.ActivateAsync(id, store); var event1 = new MyEvent(); var event2 = new MyEvent(); var newState = new MyDomainState(); sut.RaiseEvent(event1); sut.RaiseEvent(event2); sut.UpdateState(newState); await sut.WriteAsync(A.Fake <ISemanticLog>()); A.CallTo(() => persistence.WriteSnapshotAsync(newState)) .MustHaveHappened(); A.CallTo(() => persistence.WriteEventsAsync(A <IEnumerable <Envelope <IEvent> > > .That.Matches(x => x.Count() == 2))) .MustHaveHappened(); Assert.Empty(sut.GetUncomittedEvents()); }