public async Task Client_Should_be_able_to_publish_and_consume_messages_When_publishing_batch() { var subject = Context.GenerateSubject(); var messages = new[] { "My test string\r\nwith two lines and\ttabs!", "Foo bar!", "My async test string\r\nwith two lines and\ttabs!", "Async Foo bar!" }; _sync = Sync.Max(4); _client1 = await Context.ConnectClientAsync(); _client1.MsgOpStream.Subscribe(msg => _sync.Release(msg)); _client1.Sub(subject); await Context.DelayAsync(); _client1.PubMany(p => { p.Pub(subject, messages[0]); p.Pub(subject, Encoding.UTF8.GetBytes(messages[1])); }); await _client1.PubManyAsync(async p => { await p.PubAsync(subject, messages[2]); await p.PubAsync(subject, Encoding.UTF8.GetBytes(messages[3])); }); _sync.WaitForAll(); _sync.InterceptedCount.Should().Be(messages.Length); _sync.Intercepted.Select(m => m.GetPayloadAsString()).ToArray().Should().Contain(messages); }