public async Task SavesEachEventAndAllowsInterestedPartiesToDealWithEvents() { var harness = new RepoBuilder() .WithNewAggregate() .Build(); await harness.Save(); harness.EnsureAnEventWasSavedToTheEventStore(); harness.EnsureThePublisherWasNotifiedOfTheEvent(); }
public async Task IfSaveIsInterrupted_CorrectExceptionIsThrown() { var harness = new RepoBuilder() .WithNewAggregate() .WithExistingData() .Build(); await Assert.ThrowsAsync <EventStoreConcurrencyException>(() => harness.Save()); harness.EnsureNoEventsWereSavedToTheEventStore(); harness.EnsureThePublisherWasNotNotifiedOfTheEvent(); }
public async Task AllEventsAreLoadedUpProperly() { var agg = new AggregateBuilder() .WithAppend("1") .WithAppend("2") .WithAppend("3") .WithCommand("*") .Build(); var harness = new RepoBuilder() .WithAggregate(agg) .Build(); await harness.Save(); var agg2 = await harness.Load(agg.Id); Assert.Equal(agg, agg2); }