public void Add_CalledWithNullUncommittedEvent_ExpectArgumentNullExceptionWithCorrectParamName() { using (var stream = new NEventStoreSessionStream(DummyEventStreamsInSession(), DummyEventStream())) { stream.Invoking(x => x.Add(null)).ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("uncommittedEvent"); } }
public void Dispose_CalledWhenEventStreamThrowsAnException_ExpectStreamRemovesItselfFromTheSessionCollection() { var eventStream = StubEventStream(); eventStream.When(x => x.Dispose()).Do(_ => { throw new Exception(); }); var sessionCollection = new ConcurrentDictionary<Guid, IEventStream>(); var stream = new NEventStoreSessionStream(sessionCollection, eventStream); stream.Invoking(x => x.Dispose()).ShouldThrow<Exception>(); sessionCollection.Should().NotContainValue(stream); }