示例#1
0
        public void FixturesAndResults_ReturnsWithAViewResult_WithAListOfLeagues()
        {
            // Arrange
            var serviceMock = new Mock <ILeagueService>();
            var hostingMock = new Mock <IHostingEnvironment>();

            serviceMock.Setup(x => x.GetAll(hostingMock.Object.WebRootPath)).Returns(GetTestLeagues());
            var controller = new CompetitionController(serviceMock.Object, hostingMock.Object);

            // Act
            var result = controller.FixturesAndResults();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <IEnumerable <League> >(viewResult.ViewData.Model);

            Assert.Equal(3, model.Count());
        }