Exemplo n.º 1
0
        public void ValidateNullStringNotStartsWithValue()
        {
            // Given
            var validator = new StringInverseValidator(null);

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

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

            // When
            validator.StartWith(null);

            // Then
            Assert.True(true);
        }
Exemplo n.º 3
0
        public void ValidateNullStringNotStartsWithNullViolated()
        {
            // Given
            var validator = new StringInverseValidator(null);

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

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

            Assert.Equal(
                $"{rn}validator{rn}is \"\"{rn}but was expected not to start with \"\"",
                exception.UserMessage);
        }
Exemplo n.º 4
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);
        }