2013-02-15 85 views
0

這個簡單的生成單元測試呼叫控制器「太多的自動重定向」錯誤MVC單元測試

[TestMethod()] 
    [HostType("ASP.NET")] 
    [AspNetDevelopmentServerHost("E:\\Backup\\Proyecto", "/Proyecto")] 
    [UrlToTest("http://localhost:40053/Proyecto/")] 
    public void BatchUpdateTest() 
    { 
     FacturaController target = new FacturaController(); // TODO: Initialize to an appropriate value 
     Factura Factura = null; // TODO: Initialize to an appropriate value 
     JsonResult expected = null; // TODO: Initialize to an appropriate value 
     JsonResult actual; 
     actual = target.BatchUpdate(Factura); 
     Assert.AreEqual(expected, actual); 
     Assert.Inconclusive("Verify the correctness of this test method."); 
    } 

但拋出我這個錯誤:

"Could not connect to the Web server for page 'localhost:40053/Proyecto'. Too many automatic redirections were attempted.. Check that the Web server is running and visible on the network and that the page specified exists."

我可以連接到集成的Web服務器與Visual Studio的瀏覽器

與此相關,但不幫我:"too many automatic redirections were attempted" error message when using a httpWebRequest in .NET

我應該保存餅乾嗎?

+0

什麼是你的問題?你能否給出更多的背景知識,你爲達到這種行爲而採取的步驟以及你期望的行爲?有關部件的一些小代碼也可以幫助我們診斷您的問題。 – 2013-02-15 14:22:19

回答

0

只是刪除了TestMethod的聲明之後的變質劑和它的工作:

[TestMethod()] 
public void BatchUpdateTest() 
{ 
... 
}