Exemplo n.º 1
0
            protected override void OnValidate(ValidationContext <TestItem> context)
            {
                if (!context.HasError(x => x.Code))
                {
                    context.AddError(x => x.Code, ValidatorStrings.InvalidFormat);
                }

                if (!context.HasError(x => x.Code))
                {
                    Assert.Fail();
                }

                context.Check(x => x.Text, (v) => string.IsNullOrEmpty(v), ValidatorStrings.MaxCountFormat, 10);
                context.Check(x => x.Text, (v) => throw new NotFoundException(), ValidatorStrings.MaxCountFormat, 10);
            }