testing - Hide public method used to help test a .NET assembly -
I have a .NET assembly, which has to be issued. The construction of its release includes:
- People using a public, documented API methods
- A public but notified API of other methods, which is the only assembly Helping the test, and those who do not have to use
The assembly to be released is a custom control, not an application to regress-test, I will call it a test framework / Running in the application I, who does that (advanced / use extra) Some advanced / non-documented methods of documentary API are export controls.
In the manner in which I do not want to use the public, I sent them to & lt; Exclude & gt;
attribute, for example: tag (supported by Sandcastle Help File Builder), and using [EditorBrowsable]
/// & lt; Summary & gt; /// A & lt; Gets cref = "IEditorTransaction" /> Example, which helps in combining several DOM edits in one transaction, ///, which can be redone / rewritten as a single, atomic operation and /// & lt; / Summary & gt; /// & lt; Returns & gt; A & lt; See cref = "IEditorTransaction" /> Examples. & Lt; / Returns & gt; IEditorTransaction createEditorTransaction (); /// & lt; Outside & gt; [EditorBrause (never ADRCbaseableState)] Zero Debug Dumbboxes (Text Worker Output);
This successfully removes the method from the API documentation and Intelligence. However, if I right-click on an example of the interface to see its definition in metadata in a sample application program, then I can still see the method, and in the form of [EditorBrowsable]
Example:
// summary: // gets a model text. Modaldom Node The IEditorTransaction example, which helps to combine several DOM edits into one transaction, as if they were a single, atomic operation, such as // // Return: // a ModelText.modeldom.nodes.EditatorBar example. IEditorTransaction createEditorTransaction (); // [Editor never enabled (never enteroborbaseblight)] zero debug dumbbox (text worker output);
Question:
- Is there a way to hide the public method from meta data?
- If not, instead, for this scenario, would you recommend creating
internal
methods and using theInternalVisibleTo
attribute? Or would you advise in any other way, and if so, what and why?
Thank you.
internal
/ internsVisibleTo
is a good way , But it still generates methods in compiled code and they will be available through reflection.
You can always use a conditional compilation icon for unit testing which only adds test methods and, when your release version is created, that symbol is not defined. Types, methods have not been made in "survival", while not made in "Test" configuration.
Comments
Post a Comment