TopicPathFor() public method

public TopicPathFor ( Type type ) : string
type System.Type
return string
Example #1
0
 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);
 }
Example #2
0
 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");
 }
Example #3
0
 public void WhenCreatingAQueueForANestedType_WeShouldStripOutPlusSigns()
 {
     var pathFactory = new PathFactory(new GlobalPrefixSetting());
     var path = pathFactory.TopicPathFor(typeof(MyEscapingTestMessages.EscapingTestMessage));
     path.ShouldNotContain("+");
 }
Example #4
0
        public void WhenCreatingATopicForATypeWithAVeryLongName_WeShouldHaveAPathOfTheCorrectMaximumLength()
        {
            var prefix = new string('x', 230);
            var pathFactory = new PathFactory(new GlobalPrefixSetting {Value = prefix});

            var path = pathFactory.TopicPathFor(typeof(SimpleEvent));

            path.Length.ShouldBe(PathFactory.MaxPathLength);

            var expectedFullPath = $"{prefix}.t.nimbus.unittests.infrastructuretests.messagecontracts.simpleevent";
            var expectedShortenedPath = PathFactory.Shorten(expectedFullPath, PathFactory.MaxPathLength);
            path.ShouldBe(expectedShortenedPath);
        }