public void IndexAction_ModelIsTypeOfArtistList() { // arrange var mock = new Mock <IArchitectRepository>(); mock.Setup(a => a.GetArchitectList()).Returns(new List <Architect>()); ArchitectController controller = new ArchitectController(mock.Object); // act ViewResult result = controller.Index() as ViewResult; // assert Assert.IsInstanceOfType(result.Model, typeof(List <Architect>)); }
public void IndexAction_ReturnsIndexView() { // arrange string expected = "Index"; var mock = new Mock <IArchitectRepository>(); ArchitectController controller = new ArchitectController(mock.Object); // act ViewResult result = controller.Index() as ViewResult; // assert Assert.IsNotNull(result); Assert.AreEqual(expected, result.ViewName); }
public void IndexAction_NoData_ViewBagMessageNoData() { // arrange string expected = "No architects found."; var mock = new Mock <IArchitectRepository>(); mock.Setup(a => a.GetArchitectList()).Returns(new List <Architect>()); ArchitectController controller = new ArchitectController(mock.Object); // act ViewResult result = controller.Index() as ViewResult; string actual = result.ViewBag.NoDataFoundMessage as string; // assert Assert.AreEqual(expected, actual); }