vendredi 1 avril 2016

VS2015 Unit test project is unable to find a method

I'm getting this error:

Result StackTrace: at UnitTestProject.ControllerTest.TestMethodQuoteEndCustomerSearch() Result Message: Test method UnitTestProject.ControllerTest.TestMethodQuoteEndCustomerSearch threw exception: System.MissingMethodException: Method not found: 'System.Web.Mvc.ActionResult QuoteCenter.Controllers.ECSearchController.QuoteEndCustomerSearch(System.String, System.String, System.String, System.String)'.

My Test class looks like this:

namespace UnitTestProject
{
    [TestClass]
    public class ControllerTest
    {
        [TestMethod]
        public void TestMethodQuoteEndCustomerSearch()
        {
        //arrange
        ECSearchController myController = new ECSearchController();           

        //ISSUE WITH THE NEXT LINE
        ViewResult result = myController .QuoteEndCustomerSearch("", "", "", "") as ViewResult;
        }
    }
}

The intellisense knows that myController has a method QuoteEndCustomerSearch. But when I debug I get the above error.

The controller's method looks like this:

[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
    public ActionResult QuoteEndCustomerSearch(String quoteId, String CID, String URL, String UserID)
    { 
        //...
        return View("QuoteEndCustomerSearch", model);
    }

Any tips on what else I should try to get it working? I'm in Admin mode and I've restarted VS2015.

Aucun commentaire:

Enregistrer un commentaire