mercredi 24 juin 2015

How do I reference the HomeController in a UnitTest?

I am getting the following error with a UnitTest for VS 2013 The type or namespace name 'HomeController' could not be found (are you missing a using directive or an assembly reference?)

My code is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Admin.Web.API;
using Admin.Web.API.Controllers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Web.Mvc;

namespace Admin.Web.API.Controllers.Tests
{
    [TestClass()]
    public class HomeControllerTests
    {
        [TestMethod()]
        public void IndexTest()
        {
            var controller = new HomeController();
            ActionResult _Result = controller.Login("jschultz0614@gmail.com", "********") as ActionResult;
            Assert.IsInstanceOfType(_Result, typeof(RedirectToRouteResult));
        }
    }
}

And it is puking on the controller line.

What am I missing?

Aucun commentaire:

Enregistrer un commentaire