Beispiel #1
0
        public void ValidateReferenceTypeNotToBeOfType()
        {
            // Given
            var validator = new ReferenceTypeInverseValidator <object>(42);

            // When
            validator.BeOfType <String>();

            // Then
            Assert.True(true);
        }
Beispiel #2
0
        public void ValidateReferenceTypeNotToBeOfTypeViolated()
        {
            // Given
            var validator = new ReferenceTypeInverseValidator <object>(42);

            // When
            var exception = Assert.Throws <XunitException>(() => validator.BeOfType <Int32>());

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

            Assert.Equal(
                $"{rn}validator{rn}is \"Int32\"{rn}but was expected not to be of that type",
                exception.UserMessage);
        }