public void AllProjects_ReturnsViewResultContainingAllProjects() { IProjectRepository fakeProjectRepository = CreateFakeRepository(); ProjectsController controller = new ProjectsController(fakeProjectRepository); var result = controller.AllProjects(); Assert.IsInstanceOf <ViewResult>(result); ViewResult viewResult = (ViewResult)result; Projects[] resultModel = ((IEnumerable <Projects>)viewResult.ViewData.Model).ToArray(); Assert.AreEqual(resultModel.Length, 2); Assert.AreEqual("tytul 1", resultModel[0].Title); Assert.AreEqual("tytul 2", resultModel[1].Title); }