Example #1
0
        public void FilterSubmissions_UserSpecified_ReturnsUserSubmissionsForAssignment()
        {
            var assignments = CreateAssignments(1);
            var user        = new User()
            {
                Id = 10
            };
            var submissions = Collections.CreateList
                              (
                CreateSubmission(assignmentId: 1, userId: 10),
                CreateSubmission(assignmentId: 1, userId: 20),
                CreateSubmission(assignmentId: 2, userId: 10)
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterSubmissions
                                   (
                assignments,
                submissions,
                user
                                   );

            Assert.Equal(1, results.Count);
            Assert.Equal(submissions[0], results[0]);
        }
Example #2
0
        public void FilterSubmissions_UserAndDateSpecified_ReturnsUserSubmissionsForAssignmentThroughDate()
        {
            var assignments = CreateAssignments(1);
            var user        = new User()
            {
                Id = 10
            };
            var submissions = Collections.CreateList
                              (
                CreateSubmission(assignmentId: 1, userId: 10, dateSubmitted: GetDate(1)),
                CreateSubmission(assignmentId: 1, userId: 20, dateSubmitted: GetDate(1)),
                CreateSubmission(assignmentId: 2, userId: 10, dateSubmitted: GetDate(2))
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterSubmissions
                                   (
                assignments,
                submissions,
                user,
                snapshotDate: GetDate(1)
                                   );

            Assert.Equal(1, results.Count);
            Assert.Equal(submissions[0], results[0]);
        }
Example #3
0
        public void FilterSubmissions_NoUserOrDateSpecified_ReturnsSubmissionsForAssignment()
        {
            var assignments = CreateAssignments(1);
            var submissions = Collections.CreateList
                              (
                CreateSubmission(assignmentId: 1),
                CreateSubmission(assignmentId: 1),
                CreateSubmission(assignmentId: 2)
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterSubmissions
                                   (
                assignments,
                submissions
                                   );

            Assert.Equal(2, results.Count);
            Assert.Equal(submissions[0], results[0]);
            Assert.Equal(submissions[1], results[1]);
        }