Ejemplo n.º 1
0
        public void should_create_stream_with_no_stream_exp_ver_on_first_write_if_does_not_exist()
        {
            const string stream = "should_create_stream_with_no_stream_exp_ver_on_first_write_if_does_not_exist";
            using (var store = new EventStoreConnection(MiniNode.Instance.TcpEndPoint))
            {
                var append = store.AppendToStreamAsync(stream, ExpectedVersion.NoStream, new[] {new TestEvent()});
                Assert.DoesNotThrow(append.Wait);

                var read = store.ReadEventStreamForwardAsync(stream, 0, 2);
                Assert.DoesNotThrow(read.Wait);
                Assert.That(read.Result.Events.Length, Is.EqualTo(2));
            }
        }
Ejemplo n.º 2
0
        public void should_create_stream_if_commits_no_events_to_empty_stream()
        {
            const string stream = "should_create_stream_if_commits_no_events_to_empty_stream";
            using (var store = new EventStoreConnection(MiniNode.Instance.TcpEndPoint))
            {
                var start = store.StartTransactionAsync(stream, ExpectedVersion.NoStream);
                Assert.DoesNotThrow(start.Wait);
                var commit = store.CommitTransactionAsync(start.Result.TransactionId, start.Result.Stream);
                Assert.DoesNotThrow(commit.Wait);

                var streamCreated = store.ReadEventStreamForwardAsync(stream, 0, 1);
                Assert.DoesNotThrow(streamCreated.Wait);

                Assert.That(streamCreated.Result.Events.Length, Is.EqualTo(1));//stream created event
            }
        }
Ejemplo n.º 3
0
 public static Task <EventStreamSlice> ReadEventStreamAsync(string stream, int start, int count)
 {
     return(_connection.ReadEventStreamForwardAsync(stream, start, count));
 }