public void be_able_to_read_slice_from_arbitrary_position() { const string stream = "read_event_stream_forward_should_be_able_to_read_slice_from_arbitrary_position"; using (var store = EventStoreConnection.Create()) { store.Connect(MiniNode.Instance.TcpEndPoint); var create = store.CreateStreamAsync(stream, false, new byte[0]); Assert.DoesNotThrow(create.Wait); var testEvents = Enumerable.Range(0, 10).Select(x => new TestEvent((x + 1).ToString())).ToArray(); var write10 = store.AppendToStreamAsync(stream, ExpectedVersion.EmptyStream, testEvents); Assert.DoesNotThrow(write10.Wait); var read = store.ReadEventStreamForwardAsync(stream, 5, 2); Assert.DoesNotThrow(read.Wait); Assert.That(TestEventsComparer.Equal(testEvents.Skip(4).Take(2).ToArray(), read.Result.Events)); } }
public void return_events_in_same_order_as_written() { const string stream = "read_event_stream_forward_should_return_events_in_same_order_as_written"; using (var store = EventStoreConnection.Create()) { store.Connect(MiniNode.Instance.TcpEndPoint); var create = store.CreateStreamAsync(stream, false, new byte[0]); Assert.DoesNotThrow(create.Wait); var testEvents = Enumerable.Range(0, 10).Select(x => new TestEvent((x + 1).ToString())).ToArray(); var write10 = store.AppendToStreamAsync(stream, ExpectedVersion.EmptyStream, testEvents); Assert.DoesNotThrow(write10.Wait); var read = store.ReadEventStreamForwardAsync(stream, StreamPosition.FirstClientEvent, testEvents.Length); Assert.DoesNotThrow(read.Wait); Assert.That(TestEventsComparer.Equal(testEvents, read.Result.Events)); } }