mardi 30 août 2016

Unit test C# Asp.Net MVC5 methods GET and POST

If I have one method [HttpGet]Index(), and another [HttpPost] Index() then I can't call the unit test in this way:

 [TestClass()]
public class CalculatorControllerTest
{
    [TestMethod]
    public void Index()
    {
        // Arrange
        CalculatorController controller = new CalculatorController();

        // Act
        ViewResult result = controller.Index() as ViewResult;

        // Assert
        Assert.IsNotNull(result);
    }
}

Index() is going marked red.

How can I alter my request in Unit test?

Aucun commentaire:

Enregistrer un commentaire