public void Index() { // Arrange PingController controller = new PingController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); Assert.AreEqual("Home Page", result.ViewBag.Title); }
public void Index() { var pingCtrl = new PingController(); var result = pingCtrl.Index(); //assert Assert.IsInstanceOf <JsonResult>(result); var data = ((JsonResult)result).Data; var type = data.GetType(); var alivePropertyInfo = type.GetProperty("alive"); var actual = alivePropertyInfo.GetValue(data, null); Assert.AreEqual(true, actual); }
public void ThisController() { var controller = new PingController(); _result = controller.Index(); }