Example #1
0
        public async Task concurrent_updates_throw_AggregateConcurrencyException()
        {
            var id = $"Persons-{Guid.NewGuid()}";
            await Repository.StoreAsync(PersonAggregateFactory.Create(id, "Joe"));

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

            await TestingUtils.UpdateOutOfSession(id, Repository);

            TestingUtils.Rename(loadedAggregate, "Gary");

            Assert.That(async() => await Repository.StoreAsync(loadedAggregate), Throws.Exception.TypeOf <AggregateConcurrencyException>());
        }