C # / Visual Studio: creating and placing test code

In JavaLand, I'm used to creating projects that contain both production and test code. I like this practice because it makes it easier to test internal code without artificially revealing internal components in a published API project.

So far, in my experiments with C # / Visual Studio / ReSharper / NUnit, I have created separate projects (i.e. separate DLLs) for production and testing code. Is this an idiom, or am I from her? If this is idiomatically correct, what is the right way to deal with exposing classes and methods for testing purposes?

Thank,

-Patrick

+5
source share
4 answers

: [InternalsVisibleTo], "" . .

MSDN, , . .

, , IMO. , ( ) .

: , : , . , . API - , , , . , , ? API - API.

, , , API-... , , .., .

, .

+5

? , Java , : -)

"" DotNetLand, , , , , :

" " , , , .

0

( unit test ). , , ( Java).

0

, , / .NET. , , , .

, / SUT. TDD/UnitTesting , " ". , , , .

- (, / ), , .

/, . [: InternalsVisibleTo ( "Test Assembly Name" )] AssemblyInfo.cs .

InternalsVisibleToAttribute MSDN

, .NET, - , . "" , .

, .

0

All Articles