Пример #1
0
        public void Validate_OnNullChar()
        {
            // Arrange
            var rawTopic = Mqtt.Topic.NullCharacter.ToString();
            var rule     = new MustNotHaveNullChar();

            // Act
            Action validatingRawTopic = () =>
                                        rule.Validate(rawTopic);

            // Assert
            validatingRawTopic.Should()
            .Throw <IllegalTopicConstructionException>(
                "because a topic using the null char is not valid");
        }
Пример #2
0
        public void Validate_OnNoNullChar()
        {
            // Arrange
            var rawTopic = TestUtils.GenerateSingleValidTopic();
            var rule     = new MustNotHaveNullChar();

            // Act
            Action validatingRawTopic = () =>
                                        rule.Validate(rawTopic);

            // Assert
            validatingRawTopic.Should()
            .NotThrow <IllegalTopicConstructionException>(
                "because the raw topic is correctly formed");
        }
Пример #3
0
        public void Validate_OnNullCharAmongTopic()
        {
            // Arrange
            var rawTopic = TestUtils.GenerateSingleValidTopic()
                           + Mqtt.Topic.NullCharacter + TestUtils.GenerateSingleValidTopic();
            var rule = new MustNotHaveNullChar();

            // Act
            Action validatingRawTopic = () =>
                                        rule.Validate(rawTopic);

            // Assert
            validatingRawTopic.Should()
            .Throw <IllegalTopicConstructionException>(
                "because a topic using the null char is not valid");
        }