Esempio n. 1
0
        public void Can_enumerate_and_add_to_journal_concurrently()
        {
            var source  = new SpeechJournalSource();
            var journal = new SpeechJournal(source, null);

            source.AddMessage("name", "first message", new ObjectId(0), 0);

            using (var enumerator = journal.GetEnumerator())
            {
                enumerator.MoveNext().Should().BeTrue();
                enumerator.Current.Message.Should().Be("first message");
                source.AddMessage("name", "second, concurrently added message", new ObjectId(0), 0);
                enumerator.MoveNext().Should().BeFalse();
            }
        }