public void IndexTest() { // Act var result = controller.Index(); // Assert Assert.IsInstanceOfType(result, typeof(ViewResult)); ViewResult viewResult = (ViewResult)result; Assert.IsInstanceOfType(viewResult.ViewData.Model, typeof(List <MaterialModel>)); List <MaterialModel> lista = (List <MaterialModel>)viewResult.ViewData.Model; Assert.AreEqual(3, lista.Count); }