Subject: [nunit-discuss] Asserting that a method has a
certain attribute



Hi!

I'm trying to assert that a given method has a certain attribute set
to it. I see there is a Has.Attribute helper. I am missing a helper to
achieve this in a more elegant way?

Sample:
var controller = FooController();

Assert.That(controller.GetType(),
Has.Attribute(typeof(AuthorizeAttribute)).Property("Roles").EqualTo("someValue"));
Assert.That(controller.GetType().GetMethod("Index"),
Has.Attribute(typeof(LogFilter)).Property("Targets").EqualTo("all"));

Thanks,
Miha.

--
You received this message because you are subscribed to the Google Groups
"NUnit-Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nunit-discuss?hl=en.

...



Programming list archiving by: Enterprise Git Hosting