Beispiel #1
0
        public void ValidateEmptyStringToBeNullOrEmpty()
        {
            // Given
            var validator = new StringValidator(string.Empty);

            // When
            validator.BeNullOrEmpty();

            // Then
            Assert.True(true);
        }
Beispiel #2
0
        public void ValidateStringToBeNullOrEmptyViolated()
        {
            // Given
            var validator = new StringValidator("string");

            // 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 \"string\"{rn}but was expected to be null or empty{rn}because that's the bottom line",
                exception.UserMessage);
        }