public void WhenCreatingAQueue_WeShouldConvertToLowerCase() { var pathFactory = new PathFactory(new GlobalPrefixSetting()); var path = pathFactory.TopicPathFor(typeof(MyEscapingTestMessages.EscapingTestMessage)); var expectedName = "t." + typeof(MyEscapingTestMessages.EscapingTestMessage).FullName.Replace("+", ".").ToLower(); path.ShouldBe(expectedName); }
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 WhenCreatingANameForAMulticastSubscriptionWithAGlobalPrefix_ThePathShouldNotStartWithThePrefix() { var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = "testprefix"}); var subscriptionName = pathFactory.SubscriptionNameFor("My Application", "My Instance", typeof(SimpleEvent)); subscriptionName.ShouldBe("my.application.my.instance.simpleevent"); }
public void WhenCreatingAnInputQueuePathWithAGlobalPrefix_ThePathShouldStartWithThePrefix() { var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = "testprefix"}); var path = pathFactory.InputQueuePathFor("My Application", "My Instance"); path.ShouldBe("testprefix.inputqueue.my.application.my.instance"); }
public void WhenCreatingATopicPathWithAGlobalPrefix_ThePathShouldStartWithThePrefix() { var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = "testprefix"}); var path = pathFactory.TopicPathFor(typeof(SimpleEvent)); path.ShouldBe("testprefix.t.nimbus.unittests.infrastructuretests.messagecontracts.simpleevent"); }
public void WhenCreatingASubscriptionForATypeASpaceShouldBeConvertedToTheSanitizeCharacter() { var pathFactory = new PathFactory(new GlobalPrefixSetting()); var subscriptionName = pathFactory.SubscriptionNameFor("My App", "App server", typeof(MyEventWithALongName)); subscriptionName.ShouldBe("my.app.app.server.myeventwithalongname"); }
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("`"); }
public void WhenCreatingASubscriptionForATypeWeHaveAMaximumLengthOf50() { var pathFactory = new PathFactory(new GlobalPrefixSetting()); var path = pathFactory.SubscriptionNameFor("MyLongApplicationName", "Appserver", typeof(MyEventWithALongName)); path.Length.ShouldBe(50); }
public void WhenCreatingADeadLetterQueueForATypeWithAVeryLongName_WeShouldHaveAPathOfTheCorrectMaximumLength() { var prefix = new string('x', 250); var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = prefix}); var path = pathFactory.DeadLetterOfficePath(); path.Length.ShouldBe(PathFactory.MaxPathLength); var expectedFullPath = $"{prefix}.deadletteroffice"; var expectedShortenedPath = PathFactory.Shorten(expectedFullPath, PathFactory.MaxPathLength); path.ShouldBe(expectedShortenedPath); }
public void WhenCreatingAQueueForANestedType_WeShouldStripOutPlusSigns() { var pathFactory = new PathFactory(new GlobalPrefixSetting()); var path = pathFactory.TopicPathFor(typeof(MyEscapingTestMessages.EscapingTestMessage)); 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; }