Having problems with unit testing a web service
-
Hi, I can't get my unit test to work. Here is the error I'm getting (I'm using NUnit)
System.Net.WebException: The request failed with the error message:
Object moved
Object moved to here.
--.
What could be wrong? Here is an idea of how my current environment: - I created a web application in the localhost IIS (a virtual directory) - under this web app, there is a
\WebServices
folder containingMyWebService.asmx
- In a different solution (also a different directory), I created a Class Library project with a Web Reference toMyWebService.asmx
- I tried testing a simple Hello World method (code below) and I'm getting the above error. In MyWebService.asmx[WebMethod]
public string HelloWorld() { return "Hello World!"; }In MyWebServiceTest.cs
[Test]
public void HelloWorldTest() {
var svc = new MyWebService();
var str = svc.HelloWorld();
Assert.That(str, Is.EqualTo("Hello World!"));
}Thanks in advance for your help.
Rafferty
-
Hi, I can't get my unit test to work. Here is the error I'm getting (I'm using NUnit)
System.Net.WebException: The request failed with the error message:
Object moved
Object moved to here.
--.
What could be wrong? Here is an idea of how my current environment: - I created a web application in the localhost IIS (a virtual directory) - under this web app, there is a
\WebServices
folder containingMyWebService.asmx
- In a different solution (also a different directory), I created a Class Library project with a Web Reference toMyWebService.asmx
- I tried testing a simple Hello World method (code below) and I'm getting the above error. In MyWebService.asmx[WebMethod]
public string HelloWorld() { return "Hello World!"; }In MyWebServiceTest.cs
[Test]
public void HelloWorldTest() {
var svc = new MyWebService();
var str = svc.HelloWorld();
Assert.That(str, Is.EqualTo("Hello World!"));
}Thanks in advance for your help.
Rafferty
When you are testing the application , Your Web services is running ?
cheers, Abhijit
-
When you are testing the application , Your Web services is running ?
cheers, Abhijit
Thanks for replying. Yes my web services are running... I just found out that it's not really a unit test issue but a general web-referencing issue. What I mean is, if I open the web service through my internet browser and invoke the methods, the methods will execute. However, if I create a simple .net project and add a web reference, I get the error stated above. Any idea why? Thanks.
Rafferty