87617ec2ea
The source listing of the GetTestSessions method of [Testing Controller Logic](https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/testing) included an end bracket due to an offset error in the line numbers: ```cs [Fact] public async Task Index_ReturnsAViewResult_WithAListOfBrainstormSessions() { // Arrange var mockRepo = new Mock<IBrainstormSessionRepository>(); mockRepo.Setup(repo => repo.ListAsync()).Returns(Task.FromResult(GetTestSessions())); var controller = new HomeController(mockRepo.Object); // Act var result = await controller.Index(); // Assert var viewResult = Assert.IsType<ViewResult>(result); var model = Assert.IsAssignableFrom<IEnumerable<StormSessionViewModel>>( viewResult.ViewData.Model); Assert.Equal(2, model.Count()); } } private List<BrainstormSession> GetTestSessions() { var sessions = new List<BrainstormSession>(); sessions.Add(new BrainstormSession() { DateCreated = new DateTime(2016, 7, 2), Id = 1, Name = "Test One" }); sessions.Add(new BrainstormSession() { DateCreated = new DateTime(2016, 7, 1), Id = 2, Name = "Test Two" }); return sessions; } ``` This has been fixed by increasing the starting offset by one. |
||
---|---|---|
.. | ||
application-model/sample | ||
dependency-injection | ||
filters | ||
routing | ||
testing/sample/TestingControllersSample | ||
actions.md | ||
application-model.md | ||
areas.md | ||
dependency-injection.md | ||
filters.md | ||
index.md | ||
routing.md | ||
testing.md |