public void ExecutionFilterAttribute_OnActionExecuting_DoesntCallOnInValid_WhenValidateReturnsTrue()
        {
            bool called = true;
            var attr = new TestAttribute();
            attr.Invalid = () => called = false;
            attr.Validation = () => true;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was called upon sucessful validation");
        }
        public void ExecutionFilterAttribute_OnActionExecuting_CallsOnInValid_WhenValidateReturnsFalse()
        {
            bool called = false;
            var attr = new TestAttribute();
            attr.Invalid = () => called = true;
            attr.Validation = () => false;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was not called upon invalid validate");
        }
Esempio n. 3
0
        public void ExecutionFilterAttribute_OnActionExecuting_DoesntCallOnInValid_WhenValidateReturnsTrue()
        {
            bool called = true;
            var  attr   = new TestAttribute();

            attr.Invalid    = () => called = false;
            attr.Validation = () => true;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was called upon sucessful validation");
        }
Esempio n. 4
0
        public void ExecutionFilterAttribute_OnActionExecuting_CallsOnInValid_WhenValidateReturnsFalse()
        {
            bool called = false;
            var  attr   = new TestAttribute();

            attr.Invalid    = () => called = true;
            attr.Validation = () => false;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was not called upon invalid validate");
        }