private void AssertThatWeWontDuplicateQueueNames() { var queueCounts = new Tuple<string, Type>[0] .Union(CommandTypes.Select(t => new Tuple<string, Type>(PathFactory.QueuePathFor(t), t))) .Union(RequestTypes.Select(t => new Tuple<string, Type>(PathFactory.QueuePathFor(t), t))) .Union(EventTypes.Select(t => new Tuple<string, Type>(PathFactory.TopicPathFor(t), t))) .GroupBy(queue => queue.Item1) .Where(dupe => dupe.Count() > 1).ToArray(); if (queueCounts.None()) return; var badTypes = queueCounts.SelectMany(dupe => dupe.Select( d => d.Item2.Name)); var message = "Your message types {0} will result in a duplicate queue name.".FormatWith(string.Join(", ", badTypes)); throw new BusException(message); }