Unit Test - Private Accessor also generated for public method?

I have created a simple C# console application (using VSTS RC) and added a simple class containing a public method. Then a C# test project was automatically genreated. In the generated code I noticed that the test method still create a PrivateAccessor to test the public method.

What's the reason for this behivior?

///Production Codeclass Arithmetic{

public int Add(int i1, int i2)

{

return i1+i2;

}} ///generated TestMethod public void AddTest()
{ object target = TestProject1.ConsoleApplication1_CAddAccessor.CreatePrivate(); .... }

[612 byte] By [Li.Ming.Net] at [2007-12-17]
# 1
Li.Ming.Net wrote:
class Arithmetic{

Because by default a 'class' is internal, and as such, it's contents are not accessible directly from an external assembly. Use 'public class Arithmetic' to get the behaviour you are expecting. You can verify this if you hover and look at the tool tip for the class in 'class view' for the project.

Joe Rohde [MSFT]

JoeRohde at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...

Visual Studio Team System

Site Classified