public async Task Enqueue_MultipleTimesInParallelAndRollback_QueueIsEmpty()
        {
            Parallel.For(0, 3, _ => { _queue.WriteAsync(_sampleOutboundEnvelope); });

            await _queue.RollbackAsync();

            (await _queue.GetLengthAsync()).Should().Be(0);
        }
Esempio n. 2
0
        public async Task Enqueue_MultipleTimesInParallelAndRollback_QueueIsEmpty()
        {
            await Task.WhenAll(
                Enumerable.Range(0, 3)
                .Select(
                    _ => _queue.WriteAsync(
                        _sampleOutboundEnvelope.Message,
                        _sampleOutboundEnvelope.RawMessage.ReadAll(),
                        _sampleOutboundEnvelope.Headers,
                        _sampleOutboundEnvelope.Endpoint.Name,
                        _sampleOutboundEnvelope.ActualEndpointName)));

            await _queue.RollbackAsync();

            (await _queue.GetLengthAsync()).Should().Be(0);
        }