Mocking attributes - C#

Posted by bob on Stack Overflow See other posts from Stack Overflow or by bob
Published on 2008-11-25T21:49:38Z Indexed on 2010/05/04 20:08 UTC
Read the original article Hit count: 347

Filed under:
|
|
|
|

I use custom Attributes in a project and I would like to integrate them in my unit-tests.

Now I use Rhino Mocks to create my mocks but I don't see a way to add my attributes (and there parameters) to them.

Did I miss something, or is it not possible? Other mocking framework? Or do I have to create dummy implementations with my attributes?

example: I have an interface in a plugin-architecture (IPlugin) and there is an attribute to add meta info to a property. Then I look for properties with this attribute in the plugin implementation for extra processing (storing its value, mark as gui read-only...)

Now when I create a mock can I add easily an attribute to a property or the object instance itself?

EDIT: I found a post with the same question -> link. The answer there is not 100% and it is Java...

EDIT 2: It can be done... searched some more (on SO) and found 2 related questions (+ answers)

here and here

Now, is this already implemented in one or another mocking framework?

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about mock