I'm creating unit tests for a Windows Forms application. One of my methods is an event-handler for a form (I don't know if this is the source of my problem):
private void ImportButton_Click(object sender, System.EventArgs e)
{
// blah blah
}
Now when I attempt to create a unit test for this method via right-clicking the source -> "Create Unit Tests" everything seems to work fine until I open the generated unit test code:
/// <summary>
///A test for ImportButton_Click
///</summary>
[TestMethod()]
[DeploymentItem("FooBar.exe")]
public void ImportButton_ClickTest()
{
// Creation of the private accessor for 'Microsoft.VisualStudio.TestTools.TypesAndSymbols.Assembly' failed
Assert.Inconclusive("Creation of the private accessor for \'Microsoft.VisualStudio.TestTools.TypesAndSy" +
"mbols.Assembly\' failed");
}
Any ideas how to fix this? I found this MSDN forum post that details the a similar issue which I don't think applies to my problem.
Looks like this is a bug in VS2008 that they never bothered to resolve... :(
https://connect.microsoft.com/VisualStudio/feedback/details/365058
This seems to be fixed more or less in VS2010 SP1, but the issue popped up again today. The assembly I was creating a test for contained covariant generic interfaces. The accessor builder didn't like that. Removing the "in" directives solved the problem and I could live with my interfaces not being covariant for the moment.
I removed the Unit tests project, since, there were only couple of classes and added a new project with new set of files, and it worked. I was able to generate accessors for testing private methods too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With