QueuePathFor() public method

public QueuePathFor ( Type type ) : string
type System.Type
return string
Esempio n. 1
0
        private IEnumerable <string> CheckForDuplicateQueueNames()
        {
            var duplicateQueues = this.AllMessageContractTypes()
                                  .Select(t => new Tuple <string, Type>(PathFactory.QueuePathFor(t), t))
                                  .GroupBy(tuple => tuple.Item1)
                                  .Where(tuple => tuple.Count() > 1)
                                  .ToArray();

            var validationErrors = duplicateQueues
                                   .Select(tuple => "Some message types ({0}) would result in a duplicate queue name of {1}".FormatWith(string.Join(", ", tuple), tuple.Key))
                                   .ToArray();

            return(validationErrors);
        }
Esempio n. 2
0
        public void WhenCreatingAQueueForATypeWithAVeryLongName_WeShouldHaveAPathOfTheCorrectMaximumLength()
        {
            var prefix = new string('x', 230);
            var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = prefix});
            var path = pathFactory.QueuePathFor(typeof(SimpleCommand));

            path.Length.ShouldBe(PathFactory.MaxPathLength);

            var expectedFullPath = $"{prefix}.q.nimbus.unittests.infrastructuretests.messagecontracts.simplecommand";
            var expectedShortenedPath = PathFactory.Shorten(expectedFullPath, PathFactory.MaxPathLength);
            path.ShouldBe(expectedShortenedPath);
        }
Esempio n. 3
0
 public void WhenCreatingAQueuePathWithAGlobalPrefix_ThePathShouldStartWithThePrefix()
 {
     var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = "testprefix"});
     var path = pathFactory.QueuePathFor(typeof(SimpleCommand));
     path.ShouldBe("testprefix.q.nimbus.unittests.infrastructuretests.messagecontracts.simplecommand");
 }
Esempio n. 4
0
 public void WhenCreatingAQueueForAGenericType_WeShouldShortenTheGenericTypeArgumentName()
 {
     var pathFactory = new PathFactory(new GlobalPrefixSetting());
     var path = pathFactory.QueuePathFor(typeof(MyCommand<string>));
     path.ShouldBe("q.nimbus.unittests.infrastructuretests.messagecontracts.mycommand.1-string");
 }
Esempio n. 5
0
 public void WhenCreatingAQueueForAGenericType_WeShouldStripOutBackticks()
 {
     var pathFactory = new PathFactory(new GlobalPrefixSetting());
     var path = pathFactory.QueuePathFor(typeof(MyCommand<string>));
     path.ShouldNotContain("`");
 }
        private IEnumerable<string> CheckForDuplicateQueueNames()
        {
            var pathFactory = new PathFactory(new GlobalPrefixSetting());
            var duplicateQueues = this.AllMessageContractTypes()
                                      .Select(t => new Tuple<string, Type>(pathFactory.QueuePathFor(t), t))
                                      .GroupBy(tuple => tuple.Item1)
                                      .Where(tuple => tuple.Count() > 1)
                                      .ToArray();

            var validationErrors = duplicateQueues
                .Select(tuple => "Some message types ({0}) would result in a duplicate queue name of {1}".FormatWith(string.Join(", ", tuple), tuple.Key))
                .ToArray();

            return validationErrors;
        }