Example test your controller, Nunit test

for you home controller:

using System.Web.Mvc;

namespace WestBanking.Controllers
    public class HomeController : Controller

        public ActionResult Index()
            return Redirect("http://netbank.test.com");

here is your test

using WestBanking.Controllers;
using NUnit.Framework;
using TestStack.FluentMVCTesting;

namespace WestBanking.ControllerTests   
    public class HomeControllerTests
        public void ShouldRedirect()
            var sut = new HomeController();

            sut.WithCallTo(x => x.Index()).ShouldRedirectTo("http://netbank.test.com");

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s