Esempio n. 1
0
        public void ValidateStringNotToBeNullValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.Be(null);

            // Then
            Assert.True(true);
        }
Esempio n. 2
0
        public void ValidateStringNotToBeCaseSensitiveValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.Be("STRING");

            // Then
            Assert.True(true);
        }
Esempio n. 3
0
        public void ValidateStringNotStartsWithNull()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.StartWith(null);

            // Then
            Assert.True(true);
        }
Esempio n. 4
0
        public void ValidateStringNotMatchesValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.Match("other");

            // Then
            Assert.True(true);
        }
Esempio n. 5
0
        public void ValidateNullStringNotStartsWithValue()
        {
            // Given
            var validator = new StringInverseValidator(null);

            // When
            validator.StartWith("other");

            // Then
            Assert.True(true);
        }
Esempio n. 6
0
        public void ValidateStringNotMatchesRegex()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.MatchRegex("^.$");

            // Then
            Assert.True(true);
        }
Esempio n. 7
0
        public void ValidateStringNotEndsWithValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.EndWith("other");

            // Then
            Assert.True(true);
        }
Esempio n. 8
0
        public void ValidateNullStringNotToBeValueViolated()
        {
            // Given
            var validator = new StringInverseValidator(null);

            // When
            var exception = Assert.Throws <XunitException>(() => validator.Be(null));

            // Then
            Assert.NotNull(exception);
            var rn = Environment.NewLine;

            Assert.Equal(
                $"{rn}validator{rn}is \"\"{rn}but was expected not to be \"\"",
                exception.UserMessage);
        }
Esempio n. 9
0
        public void ValidateStringNotStartsWithValueViolated()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            var exception = Assert.Throws <XunitException>(() => validator.StartWith("string", "that's the bottom line"));

            // Then
            Assert.NotNull(exception);
            var rn = Environment.NewLine;

            Assert.Equal(
                $"{rn}validator{rn}is \"string\"{rn}but was expected not to start with \"string\"{rn}because that's the bottom line",
                exception.UserMessage);
        }
Esempio n. 10
0
        public void ValidateStringNotMatchesRegexPatternViolated()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            var exception = Assert.Throws <XunitException>(() => validator.MatchRegex(".*", "that's the bottom line"));

            // Then
            Assert.NotNull(exception);
            var rn = Environment.NewLine;

            Assert.Equal(
                $"{rn}validator{rn}is \"string\"{rn}but was expected to not match regular expression \".*\"{rn}because that's the bottom line",
                exception.UserMessage);
        }
Esempio n. 11
0
        public void ValidateStringNotMatchesWildcardIgnoreCaseValueViolated()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            var exception = Assert.Throws <XunitException>(() => validator.Match("sT*Ng", ignoreCase: true, because: "that's the bottom line"));

            // Then
            Assert.NotNull(exception);
            var rn = Environment.NewLine;

            Assert.Equal(
                $"{rn}validator{rn}is \"string\"{rn}but was expected to not match pattern \"sT*Ng\"{rn}because that's the bottom line",
                exception.UserMessage);
        }
Esempio n. 12
0
        public void ValidateNullStringNotToBeNullOrEmptyViolated()
        {
            // Given
            var validator = new StringInverseValidator(null);

            // When
            var exception = Assert.Throws <XunitException>(() => validator.BeNullOrEmpty(because: "that's the bottom line"));

            // Then
            Assert.NotNull(exception);
            var rn = Environment.NewLine;

            Assert.Equal(
                $"{rn}validator{rn}is \"\"{rn}but was expected not to be null or empty{rn}because that's the bottom line",
                exception.UserMessage);
        }
Esempio n. 13
0
        public void ValidateStringNotToBeCaseInsensitiveValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            var exception = Assert.Throws <XunitException>(() => validator.Be("STRING", ignoreCase: true));

            // Then
            Assert.NotNull(exception);
            var rn = Environment.NewLine;

            Assert.Equal(
                $"{rn}validator{rn}is \"string\"{rn}but was expected not to be \"STRING\"",
                exception.UserMessage);
        }