Exemple #1
0
        public void TestThatJournalReaderReadsOneEvent()
        {
            var interest = new MockAppendResultInterest <Test1Source, SnapshotState>();

            _dispatcher.AfterCompleting(1);
            interest.AfterCompleting(1);

            var source        = new Test1Source();
            var streamName    = "123";
            var streamVersion = 1;

            _journal.Append <Test1Source, SnapshotState>(streamName, streamVersion, source, interest, _object);

            var accessResults = new TestResults().AfterCompleting(1);

            _journal.JournalReader <TextEntry>("test")
            .AndThenTo(reader => reader.ReadNext()
                       .AndThenConsume(@event => {
                accessResults.WriteUsing("addAll", new List <BaseEntry <string> > {
                    @event
                });
            }));

            Assert.NotNull(accessResults.ReadFrom <int, BaseEntry <string> >("entry", 0));
            Assert.Equal("1", accessResults.ReadFrom <int, string>("entryId", 0));
        }
        public FeedTest(ITestOutputHelper output)
        {
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world = World.StartWithDefaults("feed-test");

            _dispatcher = new MockJournalDispatcher();

            _journal = _world.ActorFor <IJournal <string> >(() => new InMemoryJournalActor <string>(_dispatcher));

            _entryReader = _journal.JournalReader("feed-test-reader").Await <IJournalReader>();

            _consumer = new MockFeedConsumer();

            _interest = NoOpInterest();
        }