public void And_Only_One_Report_Then_Redirect_To_Edit() { // arrange var url = "report/edit"; UrlActionContext actualContext = null; _mockUrlHelper.Setup(h => h.Action(It.IsAny <UrlActionContext>())).Returns(url).Callback <UrlActionContext>(c => actualContext = c).Verifiable("Url.Action was never called"); _mockReportService.Setup(s => s.GetSubmittedReports(It.IsAny <string>())).Returns(ReportList.Take(1).ToList); // act var result = _controller.List(); // assert _mockUrlHelper.VerifyAll(); Assert.AreEqual(typeof(RedirectResult), result.GetType()); var redirectResult = result as RedirectResult; Assert.IsNotNull(redirectResult); Assert.AreEqual(url, redirectResult.Url); Assert.AreEqual("Edit", actualContext.Action); Assert.Null(actualContext.Controller); }