title: C# Unit Testing with Accessors - Constructors don't work
body: <p>I have to write Unit test to my application but I have a problem. I am using C# and .NET 4. In my tests I can't acces private properties and methods of the class, so I am using automatically generated Accessors for every class in the Unit tests but ...</p>
  
  <p>My constructors  for Accessor classes don't accepts theirs arguments.
  Example:</p>
  
  <pre><code>class SearchControl(bool isLogged, MainWindow mainWindow);
  class MainWindow();
  </code></pre>
  
  <p>To create object of <strong>SearchControl</strong> type you need to pass mainWindow object. So if I made this with not Accessor classes I cannot acces private methods and properties and I cannot test them.</p>
  
  <pre><code>MainWindow mainWindow = new MainWindow();
  SearchControl serchControl = new SearchControl(false, mainWindow);
  </code></pre>
  
  <p>I have to use Accessor clasees but when I do this my code is underlined with red and Visual Studio says that arguments cannot be accepted. Why, when I am passing arguments of the same type. If I pass <strong>MainClass</strong> object to <strong>SearchControl_Accessor</strong> object again I can't acces the propeerties in <strong>MainClass</strong>. So the code with the accessors look like this:</p>
  
  <pre><code>MainWindow_Accessor mainWindow = new MainWindiow_Accessor();
  SearchControl_Accessor searchControl = new SearchControl_Accessor(false, mainWindow);
  </code></pre>
  
  <p>Anyone to have an idea what is wrong and what I have to do to fix it. 
  Thanks :)</p>