Exemple #1
0
        public async Task can_load_requested_version_of_aggregate()
        {
            const int NrOfEventsToAdd  = 5;
            const int FinalVersion     = 6;
            const int RequestedVersion = 2;

            var id = $"persons-{Guid.NewGuid()}";

            var agg = PersonAggregateFactory.CreateWithUncommitedUpdates(id, NrOfEventsToAdd);
            await Repository.StoreAsync(agg);

            var loadedAggregate = await Repository.GetAsync <PersonAggregate>(id, RequestedVersion);

            Assert.That(agg.Version, Is.EqualTo(FinalVersion));
            Assert.That(loadedAggregate.Version, Is.EqualTo(RequestedVersion));
        }
Exemple #2
0
 async Task CreateAndStoreUpdatedAggregate(string aggId, int nrOfUpdates)
 {
     var p = PersonAggregateFactory.CreateWithUncommitedUpdates(aggId, nrOfUpdates);
     await Repository.StoreAsync(p);
 }
Exemple #3
0
 async Task CreateAndPersistAggregateThatExceedesPageSizeTreshold(string id)
 {
     var agg = PersonAggregateFactory.CreateWithUncommitedUpdates(id, OverflownPageSize);
     await Repository.StoreAsync(agg);
 }