views:

349

answers:

1

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.

A: 

Don't make ImportButton_Click() private.

Ray
That is an option, but I was looking for an alternative that would work without a code change on the class itself. You know how it is with code ownership politics.
Jeremy