samedi 27 juin 2015

I am working on MVC and it is my first unit test so exucse me if there is stupid i do.

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WebApplication2.Controllers;
using System.Web.Mvc;

namespace WebApplication2.Tests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var ctrl = new HomeController();
            var res = ctrl.Tabular() as ViewResult;
            Assert.AreEqual("Tabular", res.ViewName);
        }
    }
}

Where HomeController ActionResult() is:

public ActionResult Tabular()
        {
            return View();
        }

When i try to do this i obtain an error like this : http://ift.tt/1JcbshQ

Could some one please let me know why i have this error and how to solve it ?

Aucun commentaire:

Enregistrer un commentaire