Пример #1
0
        public void ValidateNullStringNotEndsWithValue()
        {
            // Given
            var validator = new StringInverseValidator(null);

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

            // Then
            Assert.True(true);
        }
Пример #2
0
        public void ValidateStringNotEndsWithNull()
        {
            // Given
            var validator = new StringInverseValidator("string");

            // When
            validator.EndWith(null);

            // Then
            Assert.True(true);
        }
Пример #3
0
        public void ValidateNullStringNotEndsWithNullViolated()
        {
            // Given
            var validator = new StringInverseValidator(null);

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

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

            Assert.Equal(
                $"{rn}validator{rn}is \"\"{rn}but was expected not to end with \"\"",
                exception.UserMessage);
        }
Пример #4
0
        public void ValidateStringNotEndsWithValueViolated()
        {
            // Given
            var validator = new StringInverseValidator("string");

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