public void StoreEmptyId()
        {
            var theEvent = new FakeEvent();
            var storage = new MemoryStorage();

            Assert.Throws<ArgumentException>(() => storage.Hold(Guid.Empty, theEvent));
        }
        public void LoadUnknownId()
        {
            var storage = new MemoryStorage();

            var result = storage.Release(Guid.NewGuid());

            Assert.Empty(result);
        }
        public void DeleteCorrectId()
        {
            var guid = Guid.NewGuid();
            var theEvent = new FakeEvent();

            var storage = new MemoryStorage();
            storage.Hold(guid, theEvent);
            storage.Delete(guid);
        }
        public void LoadCorrectId()
        {
            var guid = Guid.NewGuid();
            var theEvent = new FakeEvent();

            var storage = new MemoryStorage();
            storage.Hold(guid, theEvent);
            var result = storage.Release(guid);

            Assert.Same(theEvent, result.FirstOrDefault());
        }
        public void UowDispatcherNoUow()
        {
            var uowAdapter = new FakeUowAdapter();
            var storage = new MemoryStorage();
            var context = Substitute.For<IDownstreamContext>();
            var msg = new DispatchEvent(new FakeEvent());

            var handler = new TransactionalHandler(uowAdapter, storage);
            handler.HandleDownstream(context, msg);

            context.Received().SendDownstream(msg);
        }
 public void DeleteEmptyId()
 {
     var storage = new MemoryStorage();
     Assert.Throws<ArgumentException>(() => storage.Delete(Guid.Empty));
 }
 public void DeleteUnknown()
 {
     var storage = new MemoryStorage();
     Assert.Throws<InvalidOperationException>(() => storage.Delete(Guid.NewGuid()));
 }
        public void LoadNoId()
        {
            var storage = new MemoryStorage();

            Assert.Throws<ArgumentException>(() => storage.Release(Guid.Empty));
        }