public void IndexViaDefaultConstructor() { // Arrange var controller = new HomeController(); // Act var result = controller.Index(); // Assert Assert.That(result, Is.Not.Null); Assert.IsInstanceOf<ViewResult>(result); var result2 = (ViewResult)result; Assert.IsEmpty(result2.ViewBag.Message, "message"); Assert.AreEqual(false, result2.ViewBag.ExtraMenuFeature, "extra menu feature flag"); }
public void IndexWithNewPage() { // Arrange _menuSetting.ShowNewMenu = true; var controller = new HomeController(_menuSetting); // Act var result = controller.Index(); // Assert Assert.That(result, Is.Not.Null); Assert.IsInstanceOf<ViewResult>(result); var result2 = (ViewResult)result; Assert.IsEmpty(result2.ViewBag.Message, "message"); Assert.AreEqual(true, result2.ViewBag.ExtraMenuFeature, "extra menu feature flag"); }