Testing the Webservice method in Visual Studio: why does it say that it succeeds without running a test and test?

I created the default asmx hello world web service by default:

namespace WebServiceHello
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }
}

Then I create an MS test with Visual Studio and set the expected value:

    [TestMethod()]
    [HostType("ASP.NET")]
    [AspNetDevelopmentServerHost("C:\\temp\\WebServiceHello\\WebServiceHello", "/")]
    [UrlToTest("http://localhost:7352/")]
    public void HelloWorldTest()
    {
        Service1 target = new Service1(); // TODO: Initialize to an appropriate value
        string expected = "Hello World"; // TODO: Initialize to an appropriate value
        string actual;
        actual = target.HelloWorld();
        Assert.AreEqual(expected, actual);
        // Assert.Inconclusive("Verify the correctness of this test method.");
    }

but I got this error message:

- 'http://localhost: 7352/' . - ( ASP.NET , ) ASP.NET(URL- HTML-, -, ). ASP.NET URL- ASP.NET . 'WebRequestResponse_HelloWorldTest.html' ; - .

: WebRequestResponse_HelloWorldTest.html

<html>
    <head>
    <title>Directory Listing -- /</title>
        <style>
            body {font-family:"Verdana";font-weight:normal;font-size: 8pt;color:black;} 
            p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
            b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
            h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
            h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
            pre {font-family:"Lucida Console";font-size: 8pt}
            .marker {font-weight: bold; color: black;text-decoration: none;}
            .version {color: gray;}
            .error {margin-bottom: 10px;}
            .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>
    <body bgcolor="white">

    <h2> <i>Directory Listing -- /</i> </h2></span>

            <hr width=100% size=1 color=silver>

<PRE>
 Saturday, September 25, 2010 06:39 PM        &lt;dir&gt; <A href="App_Data/">App_Data</A>
 Saturday, September 25, 2010 06:40 PM        &lt;dir&gt; <A href="bin/">bin</A>
 Saturday, September 25, 2010 06:39 PM        &lt;dir&gt; <A href="obj/">obj</A>
 Saturday, September 25, 2010 06:39 PM        &lt;dir&gt; <A href="Properties/">Properties</A>
 Saturday, September 25, 2010 06:39 PM           97 <A href="Service1.asmx">Service1.asmx</A>
 Saturday, September 25, 2010 06:39 PM          572 <A href="Service1.asmx.cs">Service1.asmx.cs</A>
 Saturday, September 25, 2010 06:44 PM        3,551 <A href="Web.config">Web.config</A>
 Saturday, September 25, 2010 06:39 PM          968 <A href="web.config.backup">web.config.backup</A>
 Saturday, September 25, 2010 06:39 PM        1,285 <A href="Web.Debug.config">Web.Debug.config</A>
 Saturday, September 25, 2010 06:39 PM        1,346 <A href="Web.Release.config">Web.Release.config</A>
 Saturday, September 25, 2010 06:40 PM        3,805 <A href="WebServiceHello.csproj">WebServiceHello.csproj</A>
 Saturday, September 25, 2010 06:40 PM        1,086 <A href="WebServiceHello.csproj.user">WebServiceHello.csproj.user</A>
</PRE>
            <hr width=100% size=1 color=silver>

              <b>Version Information:</b>&nbsp;ASP.NET Development Server 10.0.0.0

            </font>

    </body>
</html>

, , ?

+3
2

Default.aspx

+4

: Vista, VS2008 ( VS2010)

  • VS admin (, "" ).
  • Default.aspx

http://msdn.microsoft.com/en-us/library/ms243399(v=vs.90).aspx

0

Source: https://habr.com/ru/post/1766554/


All Articles