public QueuePathFor ( |
||
type | ||
return | string |
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); }
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); }
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"); }
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"); }
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; }