Trying to "test" a simple button_click event. I right click, Create Private Accessor, VS08 say it created it successfully. Then right click again say Re-Create the unit test for the button1_click method, but when I go to the test project and look at the generated test method with all of the attributes stacked on top of it, including the deployment item, the PrivateClassAccessor will not show up in Intellisense. Also the VSCodeGenAccessor file is nowhere to be seen in Solution Explorer. The book covers this in the pages 53-54. Can someone help me ??? If I try to run the tes as is, the test fails and says
Quote:
|
Failed Button1_ClickTest TestProject1 Test method TestProject1._DefaultTest.Button1_ClickTest threw exception: System.NullReferenceException: Object reference not set to an instance of an object..
|
Code:
/// <summary>
///A test for Button1_Click
///</summary>
// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
// whether you are testing a page, web service, or a WCF service.
[TestMethod()]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("C:\\Users\\Danny\\Scratch\\TDD\\TDD", "/")]
[UrlToTest("http://localhost:2434/")]
[DeploymentItem("TDD.dll")]
public void Button1_ClickTest()
{
_Default_Accessor target = new _Default_Accessor(); // TODO: Initialize to an appropriate value
object sender = null; // TODO: Initialize to an appropriate value
EventArgs e = null; // TODO: Initialize to an appropriate value
target.Button1_Click(sender, e);
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}