public void ValidateAttributesShouldWorkCorrectly() { var attributes = Reflection.GetCustomAttributes(new WebApiController()); AttributesValidator.ValidateAttributes( attributes, new ActionAttributesTestBuilder(new WebApiController(), "Test"), TestObjectFactory.GetFailingValidationActionWithTwoParameteres()); }
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"); }
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"); }
public void ValidateNoAttributesShouldFailWithAttributes() { var attributes = Reflection.GetCustomAttributes(new MvcController()); Test.AssertException <NullReferenceException>( () => { AttributesValidator.ValidateNoAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres()); }, "not have any attributes it had some"); }
public void ValidateAnyNumberOfAttributesShouldNotFailWithExpectedNumberOfAttributes() { var attributes = Reflection.GetCustomAttributes(new MvcController()); AttributesValidator.ValidateNumberOfAttributes(attributes, TestObjectFactory.GetFailingValidationActionWithTwoParameteres(), 2); }
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()); }