public Property ChannelOutboundBuffer_must_always_process_pending_writes_in_FIFO_order(IByteBuf[] writes) { if (writes.Length == 0) // skip any zero-length results return true.ToProperty(); var writeable = true; var buffer = new ChannelOutboundBuffer(TestChannel.Instance, () => { writeable = !writeable; // toggle writeability }); foreach (var message in writes) { buffer.AddMessage(message, message.ReadableBytes, TaskCompletionSource.Void); } buffer.AddFlush(); // have to flush in order to put messages into a readable state var comparer = BufferOperations.Comparer; var iterator = writes.GetEnumerator(); iterator.MoveNext(); var position = 0; do { var read = buffer.Current as IByteBuf; var match = comparer.Equals(read, iterator.Current); if (!match) return false.Label( $"ChannelOutboundBuffer item at position {position} did not match the expected value."); position++; } while (buffer.Remove() && iterator.MoveNext()); return true.ToProperty(); }