public void Can_Get_a_CMSPage_In_Other_Language_But_English() { //Arrange IPagesRepository repository = UnitTestHelpers.MockPagesRepository( new Page { Path = "A", Language = "en" }, new Page { Path = "A", Language = "es" }, new Page { Path = "B", Language = "en" } ); var controller = new NavController(repository); //Act var result = controller.Page("A", "es") as ViewResult; //Assert ((Page)result.Model).Language.ShouldEqual("es"); }
public void Can_View_A_Single_Page_Of_Pages() { // Arrange IPagesRepository repository = UnitTestHelpers.MockPagesRepository( new Page { PageId = 1 }, new Page { PageId = 2 }, new Page { PageId = 3 }, new Page { PageId = 4 }, new Page { PageId = 5 } ); var controller = new AdminController(repository, null) { PageSize = 3 }; // Act var result = controller.Pages(2) as ViewResult; // Assert if (result != null) { var displayedPages = (IList <Page>)result.ViewBag.Pages; displayedPages.Count.ShouldEqual(2); displayedPages[0].PageId.ShouldEqual(4); displayedPages[1].PageId.ShouldEqual(5); } }