Пример #1
0
        public void ValidateStringToBeEmpty()
        {
            // Given
            var validator = new StringValidator(string.Empty);

            // When
            validator.BeEmpty();

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

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