public void Should_throw_if_endpoint_name_is_too_long()
        {
            const string endpointNameGreaterThanOneHundredFiftyChars = "ThisisalooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongQueeeeeeeeeeeeeeeeeeeeeeeeeeee";
            var          ex = Assert.Throws <InvalidOperationException>(() => CheckEndpointNameComplianceForMsmq.Check(endpointNameGreaterThanOneHundredFiftyChars));

            StringAssert.Contains(endpointNameGreaterThanOneHundredFiftyChars, ex.Message);
        }
        Dictionary <string, IMessageReceiver> CreateReceivers(ReceiveSettings[] receivers, Action <string, Exception, CancellationToken> criticalErrorAction, HashSet <string> queuesToCreate)
        {
            var messagePumps = new Dictionary <string, IMessageReceiver>(receivers.Length);

            foreach (var receiver in receivers)
            {
                if (receiver.UsePublishSubscribe)
                {
                    throw new NotImplementedException("MSMQ does not support native pub/sub.");
                }

                var pump = new MessagePump(
                    transactionMode =>
                    SelectReceiveStrategy(transactionMode, TransactionScopeOptions.TransactionOptions),
                    MessageEnumeratorTimeout,
                    TransportTransactionMode,
                    IgnoreIncomingTimeToBeReceivedHeaders,
                    criticalErrorAction,
                    receiver
                    );

                // The following check avoids creating some sub-queues, if the endpoint sub queue has the capability to exceed the max length limitation for queue format name.
                CheckEndpointNameComplianceForMsmq.Check(pump.ReceiveAddress);

                queuesToCreate.Add(pump.ReceiveAddress);
                messagePumps.Add(pump.Id, pump);
            }

            return(messagePumps);
        }
        public void Should_not_throw_if_endpoint_name_is_compliant()
        {
            const string endpointName = "short-decent-endpoint-name";

            Assert.DoesNotThrow(() => CheckEndpointNameComplianceForMsmq.Check(endpointName));
        }