public void Validate_RawTopicWithWildcardAsLastChar() { // Arrange var topic = TestUtils.GenerateSingleValidTopic() + Mqtt.Topic.Separator + Mqtt.Wildcard.MultiLevel; var rule = new MustEndWithMultiLevelWildcardIfAny(); // Act Action validatingRawTopic = () => rule.Validate(topic); // Assert validatingRawTopic.Should() .NotThrow <IllegalTopicConstructionException>( "because ending a topic with a multi-level wildcard is a valid behaviour"); }
public void Validate_RawTopicWithWildcardAndSlashAsLastChars() { // Arrange var topic = TestUtils.GenerateSingleValidTopic() + Mqtt.Topic.Separator + Mqtt.Wildcard.MultiLevel + Mqtt.Topic.Separator; var rule = new MustEndWithMultiLevelWildcardIfAny(); // Act Action validatingRawTopic = () => rule.Validate(topic); // Assert validatingRawTopic.Should() .NotThrow <IllegalTopicConstructionException>( "because a final separator should not make the test fail"); }
public void Validate_RawTopicWithWildcardInItsMiddle() { // Arrange var topic = TestUtils.GenerateSingleValidTopic() + Mqtt.Topic.Separator + Mqtt.Wildcard.MultiLevel + Mqtt.Topic.Separator + TestUtils.GenerateSingleValidTopic(); var rule = new MustEndWithMultiLevelWildcardIfAny(); // Act Action validatingRawTopic = () => rule.Validate(topic); // Assert validatingRawTopic.Should() .Throw <IllegalTopicConstructionException>( "because a multi-level wildcard is allowed only at the end of the topic"); }