Example #1
0
        public void delete_is_idempotent()
        {
            var insert = new InsertEvent()
            {
                Text = "one"
            };
            var delete = new DeleteEvent();

            _projection.On(insert);
            _projection.On(delete);
            _projection.On(delete);

            var loaded = _collection.FindOneById(delete.AggregateId);

            Assert.IsNull(loaded);
        }
Example #2
0
        public void delete_does_not_generates_multiple_notifications()
        {
            var insert = new InsertEvent()
            {
                Text = "one"
            };
            var delete = new DeleteEvent();

            _projection.On(insert);
            _projection.On(delete);
            _projection.On(delete);

            var loaded = _collection.FindOneById(delete.AggregateId);

            Assert.AreEqual(2, SpyNotifier.Counter);
        }
Example #3
0
        public async Task delete_does_not_generates_multiple_notifications()
        {
            var insert = new InsertEvent()
            {
                Text = "one"
            };
            var delete = new DeleteEvent();

            await _projection.On(insert);

            await _projection.On(delete);

            await _projection.On(delete);

            Assert.AreEqual(2, SpyNotifier.Counter);
        }
Example #4
0
        public async Task delete_is_idempotent()
        {
            var insert = new InsertEvent()
            {
                Text = "one"
            };
            var delete = new DeleteEvent();

            await _projection.On(insert);

            await _projection.On(delete);

            await _projection.On(delete);

            var loaded = await _collection.FindOneByIdAsync(delete.AggregateId.AsString());

            Assert.IsNull(loaded);
        }
Example #5
0
 public void On(DeleteEvent delete)
 {
     _collection.Delete(delete, delete.AggregateId);
 }
Example #6
0
 public Task On(DeleteEvent delete)
 {
     return(_collection.DeleteAsync(delete, delete.AggregateId.AsString()));
 }