I am seeking to extend R# by filtering the basic and smart completion list
depending on the context of usage. More specifically, I believe I want to
create a R# plugin to change the visible public API of a class when I am
writing unit tests. All members of my team use R# so I believe a R# is the
best route at this time.
I prefer use TDD to create the majority of my production code. I also use
RhinoMocks for a mocking framework because I don't have to define expectations
with strings for member names and object arrays for signatures. When I use
R# to rename a member or change the signature, the RhinoMock expectation
changes with it and results in more immediate compile-time errors than runtime
exceptions (common in NMock) and my unit tests and mocks stay up to date.
The disadvantage of RhinoMock is that all mockable members MUST be public
or internal. I don't have a philosophical problem with making most members
public, or at least internal. However, the resulting API is not clear to
other members of my team. The class under test may have 5 times as many Test
API members as Production API members, if I may make the distinction.
My intent is to expose all public/internal members to test classes, but only
truly public/internal API members to production code. My concept is to attribute
the public/internal members with a well-known attribute to indicate the member
is part of the Test API as well as the Production API, where the Test API
is a super-set of the Production API. When using basic and smart completion
inside a test, I wish to show the Test API. One of may strategies to determine
"test code" would be to scan for a attribute. When in non-test
code, I wish to display only the Production API.
I spent several hours last night with Reflector trying to find where I might
start to write the classes necessary to insert a filter for the list of items
viewable in the basic and smart completion lists. While gaining yet more
respect for your product by scanning the code structure, I did not find the
place to start.
Can you help me? Most importantly, is this something I can accomplish in
R# 2.5 with the current OpenAPI? Which class/interface(s) would I need to
implement to provide the filtering service? Which interfaces will I need
to understand to determine if members are part of the Test API? Which interfaces
will I need to understand to determine the context when presenting the list
of members by examining the current class and method? Which classes must
I register the filter with?
Thank you in advance to the R# team and others who have swam the uncharted
waters of OpenAPI!