コード例 #1
0
        public void ValidationContext_OptionExtensionMethods_WorkCorrectly()
        {
            var context = new ValidationContext<string>(null);
            Assert.AreEqual(context.Options.CascadeBehavior, CascadeMode.Continue);
            context.StopOnFirstFailure();
            Assert.AreEqual(context.Options.CascadeBehavior, CascadeMode.StopOnFirstFailure);

            Assert.AreEqual(context.Options.ReportingBehavior, ReportingMode.ReturnValidationResults);
            context.ThrowOnFailure();
            Assert.AreEqual(context.Options.ReportingBehavior, ReportingMode.ThrowValidationException);
        }