Пример #1
0
        public async Task SavesEachEventAndAllowsInterestedPartiesToDealWithEvents()
        {
            var harness = new RepoBuilder()
                          .WithNewAggregate()
                          .Build();

            await harness.Save();

            harness.EnsureAnEventWasSavedToTheEventStore();
            harness.EnsureThePublisherWasNotifiedOfTheEvent();
        }
Пример #2
0
        public async Task IfSaveIsInterrupted_CorrectExceptionIsThrown()
        {
            var harness = new RepoBuilder()
                          .WithNewAggregate()
                          .WithExistingData()
                          .Build();

            await Assert.ThrowsAsync <EventStoreConcurrencyException>(() => harness.Save());

            harness.EnsureNoEventsWereSavedToTheEventStore();
            harness.EnsureThePublisherWasNotNotifiedOfTheEvent();
        }
Пример #3
0
        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);
        }