예제 #1
0
        public void ValidateAttributesShouldWorkCorrectly()
        {
            var attributes = Reflection.GetCustomAttributes(new WebApiController());

            AttributesValidator.ValidateAttributes(
                attributes,
                new ActionAttributesTestBuilder(new WebApiController(), "Test"),
                TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
        }
예제 #2
0
        public void ValidateAnyNumberOfAttributesShouldFailWithIncorrectExpectedNumberOfAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new MvcController());

            Test.AssertException <NullReferenceException>(
                () =>
            {
                AttributesValidator.ValidateNumberOfAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres(), 3);
            },
                "have 3 attributes in fact found 2");
        }
예제 #3
0
        public void ValidateAnyNumberOfAttributesShouldFailWithNoAttributes()
        {
            Test.AssertException <NullReferenceException>(
                () =>
            {
                var attributes = Reflection.GetCustomAttributes(new ClaimsPrincipalBuilder());

                AttributesValidator.ValidateNumberOfAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
            },
                "have at least 1 attribute in fact none was found");
        }
예제 #4
0
        public void ValidateNoAttributesShouldFailWithAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new MvcController());

            Test.AssertException <NullReferenceException>(
                () =>
            {
                AttributesValidator.ValidateNoAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
            },
                "not have any attributes it had some");
        }
예제 #5
0
        public void ValidateAnyNumberOfAttributesShouldNotFailWithExpectedNumberOfAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new MvcController());

            AttributesValidator.ValidateNumberOfAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres(), 2);
        }
예제 #6
0
        public void ValidateNoAttributesShouldNotFailWithNoAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new ClaimsPrincipalBuilder());

            AttributesValidator.ValidateNoAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
        }
예제 #7
0
        public void ValidateAnyNumberOfAttributesShouldFailWithNoAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new UserBuilder());

            AttributesValidator.ValidateNumberOfAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
        }
예제 #8
0
        public void ValidateNoAttributesShouldFailWithAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new WebApiController());

            AttributesValidator.ValidateNoAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
        }