Hello,
I need create unit test for my web service in VS 2008 Professional.
If I create new unit test directly on method in my App_Code directory the wizard creates new test project with selected test methods.
1 /// <summary>
2 ///A test for GetUpdatedObjects
3 ///</summary>
4 [TestMethod()]
5 [HostType("ASP.NET")]
6 [AspNetDevelopmentServerHost("C:\\Test\\code\\Web\\Core\\WebService", "/WebService")]
7 [UrlToTest("http://localhost/WebService")]
8 public void GetUpdatedObjectsTest()
9 {
10 BrokerService_Accessor target = new BrokerService_Accessor(); // TODO: Initialize to an appropriate value
11 DateTime lastUpdate = new DateTime(); // TODO: Initialize to an appropriate value
12 Guid applicationGuid = new Guid(); // TODO: Initialize to an appropriate value
13 DateTime actualUpdate = new DateTime(); // TODO: Initialize to an appropriate value
14 DateTime actualUpdateExpected = new DateTime(); // TODO: Initialize to an appropriate value
15 List expected = null; // TODO: Initialize to an appropriate value...
But if I run this test the response is following: The Web request 'http://localhost:2246/WebService' completed successfully without running the test. This can occur when configuring the Web application for testing fails (an ASP.NET server error occurs when processing the request), or when no ASP.NET page is executed (the URL may point to an HTML page, a Web service, or a directory listing). Running tests in ASP.NET requires the URL to resolve to an ASP.NET page and for the page to execute properly up to the Load event. The response from the request is stored in the file 'WebRequestResponse_GetUpdatedObjectsTes.html' with the test results; typically this file can be opened with a Web browser to view its contents.
I have tried searching another ways to testing web methods, but I have not found any good solution.
What is proper way to test web methods? What is ***_Accessor usable for?
Any help will be appreciated..