Cannot test attributes of properties

Jul 2, 2012 at 6:36 AM

I'm trying to assert that a particular property on a class has a particular attribute applied, using v1.7.1. The current documentation, suggests that I should be able to use:

 

PropertyInfo result = typeof (CreateUserModel).GetProperty("LoginName");
result.Should().BeDecoratedWith<RequiredAttribute>();

However, this does not work as there is no BeDecoratedWith extension method on the PropertyInfo class - rather there is one on the FluentAssertions class PropertyInfoAssociations. What's the best way of achieving my desired result using FA?

 

Developer
Aug 29, 2012 at 5:06 PM

I'll create an issue to add such assertions.

Developer
Aug 29, 2012 at 5:07 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.