public void CreateDocumentsListController_CallTheIndexAction_EnsuresDefaultModelPropertiesArePresented() { // Arrange using (var controller = new DummyDocumentsListController()) { // Act var view = controller.Index(null) as ViewResult; // Assert Assert.IsNotNull(view); Assert.IsNotNull(view.Model); Assert.IsTrue(view.ViewName == "List.DocumentsList"); Assert.IsTrue(view.ViewBag.CurrentPageUrl == string.Empty); Assert.IsTrue(view.ViewBag.RedirectPageUrlTemplate == "/{0}"); Assert.IsTrue(view.ViewBag.DetailsPageId == Guid.Empty); Assert.IsTrue(view.ViewBag.OpenInSamePage); Assert.IsTrue(view.ViewBag.ItemsPerPage == 20); } }
public void CreateDocumentsListController_CallTheIndexAction_EnsuresDefinedPropertiesAreSetCorrectly() { // Arrange using (var controller = new DummyDocumentsListController()) { controller.DetailsPageId = new Guid("C8420FD7-2AD0-4D34-B8CD-C0636DE5AD09"); controller.OpenInSamePage = false; controller.ListTemplateName = "ListTemplateName"; // Act var view = controller.Index(null) as ViewResult; // Assert Assert.IsNotNull(view); Assert.IsNotNull(view.Model); Assert.IsTrue(view.ViewName == "List.ListTemplateName"); Assert.IsTrue(view.ViewBag.CurrentPageUrl == string.Empty); Assert.IsTrue(view.ViewBag.RedirectPageUrlTemplate == "/{0}"); Assert.IsTrue(view.ViewBag.DetailsPageId == controller.DetailsPageId); Assert.IsFalse(view.ViewBag.OpenInSamePage); Assert.IsTrue(view.ViewBag.ItemsPerPage == 20); } }