Beispiel #1
0
        public void VerifyAnByStructureTypeAndShouldBeSuccessTest()
        {
            var @struct = new NiceStructWithAnnotation("Nice", 10);

            var result1 = AnnotationValidator.Verify(@struct);
            var result2 = AnnotationValidator.Verify(typeof(NiceStructWithAnnotation), @struct);

            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();

            result1.IsValid.ShouldBeTrue();
            result2.IsValid.ShouldBeTrue();
        }
Beispiel #2
0
        public void VerifyAnByStructureTypeAndShouldBeFailureTest()
        {
            var @struct = new NiceStructWithAnnotation("", -10);

            var result1 = AnnotationValidator.Verify(@struct);
            var result2 = AnnotationValidator.Verify(typeof(NiceStructWithAnnotation), @struct);

            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();

            result1.IsValid.ShouldBeFalse();
            result2.IsValid.ShouldBeFalse();

            result1.Errors.Should().HaveCount(2);
            result2.Errors.Should().HaveCount(2);
        }