/// <summary>
 /// Constructor.
 /// </summary>
 public StudentAssignmentsViewModel(
     StudentAssignmentResults results,
     Func<int, string> getQuestionUrl,
     ITimeZoneProvider timeZoneProvider)
 {
     LastName = results.LastName;
     FirstName = results.FirstName;
     SectionName = results.SectionName;
     AssignmentResults = results.AssignmentResults.Select
     (
         result => new AssignmentResultViewModel
         (
             result,
             getQuestionUrl,
             timeZoneProvider
         )
     ).ToList();
 }
		public async Task GetStudentAssignmentResultsAsync_ReturnsResults()
		{
			var database = GetDatabaseWithSubmissions().Build();

			var userId = database.Context.Users.First().Id;

			database.Reload();

			var expectedResults = new StudentAssignmentResults(null, null, null, null);
			var assignmentScoreCalculator = new Mock<IAssignmentScoreCalculator>();
			assignmentScoreCalculator
				.Setup
				(
					asc => asc.GetStudentAssignmentResults
					(
						It.Is<User>(user => user.UserName == "User1"),
						It.Is<Section>(section => section.Name == "Period1"),
						It.Is<IList<Assignment>>(assignments => ValidateAssignments(assignments)),
						It.Is<IList<UserQuestionSubmission>>(submissions => ValidateStudentSubmissions(submissions))
					)
				).Returns(expectedResults);

			var assignmentService = GetAssignmentService
			(
				database.Context,
				assignmentScoreCalculator.Object
			);
			
			var actualResults = await assignmentService.GetStudentAssignmentResultsAsync
			(
				"Class1",
				userId
			);

			Assert.Equal(expectedResults, actualResults);
		}
 /// <summary>
 /// Verifies student results.
 /// </summary>
 private void VerifyStudentAssignmentResults(
     StudentAssignmentResults expected,
     StudentAssignmentResults actual)
 {
     Assert.Equal(expected.LastName, actual.LastName);
     Assert.Equal(expected.FirstName, actual.FirstName);
     Assert.Equal(expected.SectionName, actual.SectionName);
     Assert.Equal(expected.AssignmentResults.Count, actual.AssignmentResults.Count);
     for (int index = 0; index < expected.AssignmentResults.Count; index++)
     {
         VerifyStudentAssignmentResult
         (
             expected.AssignmentResults[index],
             actual.AssignmentResults[index]
         );
     }
 }