コード例 #1
0
        public void should_be_unable_to_start_a_stream_without_any_events_as_string()
        {
            StoreOptions(x => x.Events.StreamIdentity = StreamIdentity.AsString);

            var @event = new IssueCreated {
                IssueId = Guid.NewGuid(), Description = "Description"
            };

            var ex = Should.Throw <EmptyEventStreamException>(() =>
            {
                var streamId = theSession.Events.StartStream <IssuesList>(@event.IssueId.ToString());
            });

            ex.Message.ShouldContain("cannot be started without any events", Case.Insensitive);
        }
コード例 #2
0
        public async Task Bug_1388_cannot_start_the_same_stream_twice_with_the_same_session()
        {
            StoreOptions(x => x.Events.StreamIdentity = StreamIdentity.AsString);

            var @event = new IssueCreated {
                IssueId = Guid.NewGuid(), Description = "Description"
            };

            theSession.Events.StartStream <IssuesList>(@event.IssueId.ToString(), @event);
            await theSession.SaveChangesAsync();

            var ex = await Should.ThrowAsync <ExistingStreamIdCollisionException>(async() =>
            {
                // Do it again
                theSession.Events.StartStream <IssuesList>(@event.IssueId.ToString(), @event);
                await theSession.SaveChangesAsync();
            });
        }