Example #1
0
        /// <summary>
        /// Creates a new assignment report generator.
        /// </summary>
        private StudentAssignmentReportGenerator CreateStudentAssignmentReportGenerator(
            Section section,
            FilterAssignmentsCall filterAssignmentsCall,
            FilterSubmissionsCall filterSubmissionsCall,
            IList <GetAssignmentGroupResultCall> getAssignmentGroupResultCalls,
            bool admin)
        {
            var assignmentFilter = CreateMockAssignmentFilter
                                   (
                section,
                filterAssignmentsCall,
                filterSubmissionsCall,
                getAssignmentGroupResultCalls.Select(t => t.AssignmentGroup).ToList()
                                   );

            var assignmentGroupResultGenerator = CreateMockAssignmentGroupResultGenerator
                                                 (
                section,
                getAssignmentGroupResultCalls,
                filterSubmissionsCall.FilteredSubmissions,
                admin
                                                 );

            return(new StudentAssignmentReportGenerator
                   (
                       assignmentGroupResultGenerator,
                       assignmentFilter
                   ));
        }
        /// <summary>
        /// Creates an updated assignment report generator.
        /// </summary>
        private SnapshotAssignmentReportGenerator CreateSnapshotAssignmentReportGenerator(
            Section section,
            IList <User> users,
            FilterAssignmentsCall filterAssignmentsCall,
            FilterSubmissionsCall filterSubmissionsCall,
            IList <GetSectionAssignmentGroupResultsCall> getSectionAssignmentGroupResultsCalls)
        {
            var assignmentFilter = CreateMockAssignmentFilter
                                   (
                section,
                filterAssignmentsCall,
                filterSubmissionsCall,
                getSectionAssignmentGroupResultsCalls.Select(c => c.AssignmentGroup).ToList()
                                   );

            var sectionAssignmentReportGenerator = CreateMockSectionAssignmentReportGenerator
                                                   (
                section,
                users,
                filterSubmissionsCall.FilteredSubmissions,
                getSectionAssignmentGroupResultsCalls
                                                   );

            return(new SnapshotAssignmentReportGenerator
                   (
                       assignmentFilter,
                       sectionAssignmentReportGenerator
                   ));
        }
        /// <summary>
        /// Returns a mock assignment filter.
        /// </summary>
        protected IAssignmentFilter CreateMockAssignmentFilter(
            Section section,
            FilterAssignmentsCall filterAssignmentsCall,
            FilterSubmissionsCall filterSubmissionsCall,
            IList <IGrouping <string, Assignment> > assignmentGroups)
        {
            var assignmentFilter = new Mock <IAssignmentFilter>();

            assignmentFilter
            .Setup
            (
                m => m.FilterAssignments
                (
                    filterAssignmentsCall.Assignments,
                    section,
                    filterAssignmentsCall.AssignmentGroupName,
                    filterAssignmentsCall.SnapshotDate
                )
            ).Returns(filterAssignmentsCall.FilteredAssignments);

            assignmentFilter
            .Setup
            (
                m => m.FilterSubmissions
                (
                    filterAssignmentsCall.FilteredAssignments,
                    filterSubmissionsCall.Submissions,
                    filterSubmissionsCall.User,
                    filterSubmissionsCall.SnapshotDate
                )
            ).Returns(filterSubmissionsCall.FilteredSubmissions);

            assignmentFilter
            .Setup
            (
                m => m.GetAssignmentGroups
                (
                    section,
                    filterAssignmentsCall.FilteredAssignments
                )
            ).Returns(assignmentGroups);

            return(assignmentFilter.Object);
        }
Example #4
0
        /// <summary>
        /// Creates a new assignment report generator.
        /// </summary>
        private SectionAssignmentReportGenerator CreateSectionAssignmentReportGenerator(
            Section section,
            FilterAssignmentsCall filterAssignmentsCall,
            FilterSubmissionsCall filterSubmissionsCall,
            IList <GetAssignmentGroupResultCall> getAssignmentGroupResultCalls,
            double totalPoints)
        {
            var assignmentFilter = CreateMockAssignmentFilter
                                   (
                section,
                filterAssignmentsCall,
                filterSubmissionsCall,
                getAssignmentGroupResultCalls.Select(t => t.AssignmentGroup).ToList()
                                   );

            var assignmentGroupResultGenerator = CreateMockAssignmentGroupResultGenerator
                                                 (
                section,
                getAssignmentGroupResultCalls,
                filterSubmissionsCall.FilteredSubmissions,
                admin: true
                                                 );

            var assignmentGroupScoreCalculator = CreateMockAssignmentGroupScoreCalculator
                                                 (
                filterAssignmentsCall.FilteredAssignments,
                totalPoints
                                                 );

            return(new SectionAssignmentReportGenerator
                   (
                       assignmentGroupResultGenerator,
                       assignmentGroupScoreCalculator,
                       assignmentFilter
                   ));
        }