Esempio n. 1
0
        public async Task read_stream()
        {
            await Store.AppendAsync("stream_2", 1, "payload").ConfigureAwait(false);

            var stream = _streams.OpenReadOnly("stream_2");
            var acc    = new Recorder();
            await ReadOnlyStreamExtensions.ReadAsync(stream, acc).ConfigureAwait(false);

            Assert.Equal(1, acc.Length);
            Assert.Equal("payload", acc[0].Payload);
        }
Esempio n. 2
0
        public void open_readonly_should_return_readonly_stream()
        {
            var stream = _store.OpenReadOnly("id");

            Assert.IsType <ReadOnlyStream>(stream);
            Assert.False(stream.IsWritable);
        }
Esempio n. 3
0
        protected virtual IStream OpenStream(IAggregate aggregate, bool isPartialLoad)
        {
            var stream = isPartialLoad
                ? _streams.OpenReadOnly(aggregate.Id)
                : _streams.OpenOptimisticConcurrency(aggregate.Id);

            _openedStreams.Add(aggregate, stream);
            return(stream);
        }
Esempio n. 4
0
        public async Task <IEnumerable <Tuple <string, DateTime> > > FavsOfTweetAsync(TweetId tweetId)
        {
            var recorded = await _streams
                           .OpenReadOnly($"{tweetId}/favs")
                           .RecordAsync();

            return(recorded.Data
                   .Cast <TweetFavorited>()
                   .Select(f => new Tuple <string, DateTime>(f.UserId, f.When)));
        }
Esempio n. 5
0
 public IReadOnlyStream OpenForRead(string streamId)
 {
     return(_streamsFactory.OpenReadOnly(streamId));
 }