Example #1
0
        public void ValidateStringNotToBeCaseSensitiveValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

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

            // Then
            Assert.True(true);
        }
Example #2
0
        public void ValidateStringNotToBeNullValue()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.Be(null);

            // Then
            Assert.True(true);
        }
Example #3
0
        public void ValidateStringNotToBeValueViolated()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            var exception = Assert.Throws <XunitException>(() => validator.Be("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 be \"string\"{rn}because that's the bottom line",
                exception.UserMessage);
        }
Example #4
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);
        }
Example #5
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);
        }