Exemplo n.º 1
0
        public void FilterAssignments_OnlySectionGiven_FiltersToAssignedInSection()
        {
            var section1 = new Section()
            {
                Id = 1
            };
            var section2 = new Section()
            {
                Id = 2
            };
            var assignments = Collections.CreateList
                              (
                CreateAssignment("Group2", section1, GetDate(5)),
                CreateAssignment("Group1", section1, GetDate(5)),
                CreateAssignment("Group1", section1, GetDate(4)),
                CreateAssignment("Group1", section2, GetDate(2)),
                CreateAssignment("Group2", section2, GetDate(1)),
                CreateAssignment("Group1", section: null, dueDate: null)
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterAssignments
                                   (
                assignments,
                section1,
                assignmentGroupName: null
                                   );

            Assert.Equal(3, results.Count);
            Assert.Equal(assignments[2], results[0]);
            Assert.Equal(assignments[1], results[1]);
            Assert.Equal(assignments[0], results[2]);
        }
Exemplo n.º 2
0
        public void FilterAssignments_GroupNameAndSectionGiven_ReturnsAssignedInGroupToSection()
        {
            var section1 = new Section()
            {
                Id = 1
            };
            var section2 = new Section()
            {
                Id = 2
            };
            var assignments = Collections.CreateList
                              (
                CreateAssignment("Group1", section1, GetDate(5)),
                CreateAssignment("Group1", section1, GetDate(4)),
                CreateAssignment("Group2", section1, GetDate(3)),
                CreateAssignment("Group1", section2, GetDate(2)),
                CreateAssignment("Group2", section2, GetDate(1)),
                CreateAssignment("Group1", section: null, dueDate: null)
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterAssignments
                                   (
                assignments,
                section1,
                "Group1"
                                   );

            Assert.Equal(2, results.Count);
            Assert.Equal(assignments[1], results[0]);
            Assert.Equal(assignments[0], results[1]);
        }
Exemplo n.º 3
0
        public void FilterAssignments_OnlyGroupNameGiven_ReturnsAllInGroup()
        {
            var section1 = new Section()
            {
                Id = 1
            };
            var section2 = new Section()
            {
                Id = 2
            };
            var assignments = Collections.CreateList
                              (
                CreateAssignment("Group1", section1, GetDate(5)),
                CreateAssignment("Group1", section1, GetDate(4)),
                CreateAssignment("Group2", section1, GetDate(3)),
                CreateAssignment("Group1", section2, GetDate(2)),
                CreateAssignment("Group2", section2, GetDate(1)),
                CreateAssignment("Group1", section: null, dueDate: null)
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterAssignments
                                   (
                assignments,
                null /*section*/,
                "Group1"
                                   );

            Assert.Equal(4, results.Count);
            Assert.Equal(assignments[3], results[0]);
            Assert.Equal(assignments[1], results[1]);
            Assert.Equal(assignments[0], results[2]);
            Assert.Equal(assignments[5], results[3]);
        }
Exemplo n.º 4
0
        public void FilterAssignments_NeitherGroupNameNorSectionGiven_ReturnsAllAssignments()
        {
            var section1 = new Section()
            {
                Id = 1
            };
            var section2 = new Section()
            {
                Id = 2
            };
            var assignments = Collections.CreateList
                              (
                CreateAssignment("Group1", section1, GetDate(5)),
                CreateAssignment("Group1", section1, GetDate(4)),
                CreateAssignment("Group2", section1, GetDate(3)),
                CreateAssignment("Group1", section2, GetDate(2)),
                CreateAssignment("Group2", section2, GetDate(1)),
                CreateAssignment("Group1", section: null, dueDate: null)
                              );

            var assignmentFilter = new AssignmentFilter();
            var results          = assignmentFilter.FilterAssignments
                                   (
                assignments,
                section: null,
                assignmentGroupName: null
                                   );

            Assert.Equal(6, results.Count);
            Assert.Equal(assignments[4], results[0]);
            Assert.Equal(assignments[3], results[1]);
            Assert.Equal(assignments[2], results[2]);
            Assert.Equal(assignments[1], results[3]);
            Assert.Equal(assignments[0], results[4]);
            Assert.Equal(assignments[5], results[5]);
        }