public void Table_ReturnsWithAViewResult_WithAListOfLeagues() { // Arrange var leagueMock = new Mock <ILeagueService>(); var hostingMock = new Mock <IHostingEnvironment>(); leagueMock.Setup(x => x.GetAll(hostingMock.Object.WebRootPath)).Returns(GetTestLeagues()); var controller = new CompetitionController(leagueMock.Object, hostingMock.Object); // Act var result = controller.Table(); // Assert var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsAssignableFrom <IEnumerable <League> >(viewResult.ViewData.Model); Assert.Equal(3, model.Count()); }