public void ValidateAttributesShouldWorkCorrectly()
        {
            var attributes = Reflection.GetCustomAttributes(new WebApiController());

            AttributesValidator.ValidateAttributes(
                attributes,
                new ActionAttributesTestBuilder(new WebApiController(), "Test"),
                TestObjectFactory.GetFailingValidationActionWithTwoParameteres());
        }
Example #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");
        }
Example #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");
        }
Example #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");
        }
Example #5
0
        public void ValidateAnyNumberOfAttributesShouldNotFailWithExpectedNumberOfAttributes()
        {
            var attributes = Reflection.GetCustomAttributes(new MvcController());

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

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

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

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