Exemple #1
0
        public void ValidateNullableNotToBeNull()
        {
            // Given
            var validator = new NullableGuidInverseValidator(Guid.Empty);

            // When
            validator.BeNull();

            // Then
            Assert.True(true);
        }
Exemple #2
0
        public void ValidateGuidNotToBeEmpty()
        {
            // Given
            var validator = new NullableGuidInverseValidator(Guid.NewGuid());

            // When
            validator.BeEmpty();

            // Then
            Assert.True(true);
        }
Exemple #3
0
        public void ValidateGuidNotToBeEmptyViolated()
        {
            // Given
            var validator = new NullableGuidInverseValidator(Guid.Empty);

            // 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 \"{Guid.Empty}\"{rn}but was expected not to be empty{rn}because that's the bottom line",
                exception.UserMessage);
        }
Exemple #4
0
        public void ValidateNullableNotToBeNullWithReasonViolated()
        {
            // Given
            var validator = new NullableGuidInverseValidator(null);

            // When
            var exception = Assert.Throws <XunitException>(() => validator.BeNull("that's the bottom line"));

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

            Assert.Equal(
                $"{rn}validator{rn}is null{rn}but was expected not to be null{rn}because that's the bottom line",
                exception.UserMessage);
        }