ASP.NET MVC > Unit testing

Create new test case method in ASP.NET MVC

How to create a new test case method in Unit test project?


To create a new Test case method, create a new method in the Unit test class and decorate with [TestMethod].

TEST CLASS CODE

using System;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace WebApplicationTest
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {

        }

        [TestMethod]
        public void CreateViewTest()
        {

        }
    }
}

See the highlighted code that has a method with [TestMethod] attribute.

 Views: 8161 | Post Order: 134



Write for us






Hosting Recommendations