Ejemplo n.º 1
0
        public void Write_WithMultipleAssignmentsBottomRowsAndMultipleColumns_DrawsBorderAtEachRowAndUpUntilMostRightColumn()
        {
            // Arrange
            int        headerRow            = 1;
            int        totalRow             = 10;
            int        gradeRow             = 11;
            int        mostRightColumn      = 5;
            List <int> assignmentBottomRows = new List <int> {
                2, 5, 9
            };

            var sut = new BorderBlock(headerRow, assignmentBottomRows, totalRow, gradeRow, mostRightColumn);

            // Act
            sut.Write(_spreadsheetWriter);

            // Assert
            for (int columnIndex = 1; columnIndex <= mostRightColumn; columnIndex++)
            {
                foreach (int assignmentBottomRow in assignmentBottomRows)
                {
                    _spreadsheet[columnIndex, assignmentBottomRow].Should().Be("Bottom + Thin");
                }
            }
        }
Ejemplo n.º 2
0
        public void Write_WithMostRightColumn_DrawsBorderUpUntilMostRightColumn()
        {
            // Arrange
            int        headerRow                   = 1;
            int        totalRow                    = 10;
            int        gradeRow                    = 11;
            int        mostRightColumn             = 5;
            int        expectedAssignmentBottomRow = 5;
            List <int> assignmentBottomRows        = new List <int> {
                expectedAssignmentBottomRow
            };

            var sut = new BorderBlock(headerRow, assignmentBottomRows, totalRow, gradeRow, mostRightColumn);

            // Act
            sut.Write(_spreadsheetWriter);

            SpreadsheetTestUtilities.PrintArraySpreadsheet(_spreadsheet);

            // Assert
            for (int columnIndex = 1; columnIndex < mostRightColumn; columnIndex++)
            {
                _spreadsheet[columnIndex, expectedAssignmentBottomRow].Should().Be("Bottom + Thin");
            }
        }
Ejemplo n.º 3
0
        public void Write_WithMultipleAssignmentsBottomRows_DrawsBorderAtRow()
        {
            // Arrange
            int        headerRow            = 1;
            int        totalRow             = 10;
            int        gradeRow             = 11;
            int        mostRightColumn      = 1;
            List <int> assignmentBottomRows = new List <int> {
                4, 5, 9
            };

            var sut = new BorderBlock(headerRow, assignmentBottomRows, totalRow, gradeRow, mostRightColumn);

            // Act
            sut.Write(_spreadsheetWriter);

            // Assert
            foreach (int assignmentBottomRow in assignmentBottomRows)
            {
                _spreadsheet[1, assignmentBottomRow].Should().Be("Bottom + Thin");
            }
        }
        private void PrintScoreSheet(
            Class @class,
            Test test,
            ISpreadsheetWriter spreadsheetWriter,
            ConfigurationBlock configurationBlock)
        {
            spreadsheetWriter
            .NewLine()
            .NewLine();

            var assignmentsBlock = new AssignmentsBlock(spreadsheetWriter.CurrentPosition,
                                                        test.Assignments,
                                                        test.NumberOfVersions);

            assignmentsBlock.Write(spreadsheetWriter);

            spreadsheetWriter.CurrentPosition = assignmentsBlock.ScoresHeaderPosition;
            spreadsheetWriter.MoveRight();
            int studentNamesStartColumn = spreadsheetWriter.CurrentPosition.X;
            var studentNamesBlock       = new StudentNamesBlock(spreadsheetWriter.CurrentPosition, @class.Students, assignmentsBlock.LastQuestionRow);

            studentNamesBlock.Write(spreadsheetWriter);

            spreadsheetWriter.CurrentPosition = new Point(spreadsheetWriter.CurrentPosition.X, assignmentsBlock.LastQuestionRow);
            spreadsheetWriter.NewLine();

            var scoresTopRow = new Point(assignmentsBlock.ScoresHeaderPosition.X, assignmentsBlock.ScoresHeaderPosition.Y + 1);

            AddTotalPointsRow(spreadsheetWriter,
                              scoresTopRow,
                              @class.Students.Count);
            var achievedScoresRow = spreadsheetWriter.CurrentPosition.Y;

            spreadsheetWriter.NewLine();

            var numberOfStudents = @class.Students.Count;

            AddGradesRow(spreadsheetWriter,
                         achievedScoresRow,
                         assignmentsBlock.ScoresHeaderPosition.X,
                         new Point(assignmentsBlock.ScoresHeaderPosition.X, achievedScoresRow),
                         configurationBlock.MinimumGradePosition,
                         configurationBlock.StandardizationfactorPosition,
                         numberOfStudents,
                         _formulaBuilderFactory);
            var gradesRow = spreadsheetWriter.CurrentPosition.Y;

            spreadsheetWriter.NewLine();
            spreadsheetWriter.NewLine();

            AddAverageResults(
                spreadsheetWriter,
                achievedScoresRow,
                gradesRow,
                studentNamesStartColumn,
                numberOfStudents);

            var borderBlock = new BorderBlock(
                assignmentsBlock.ScoresHeaderPosition.Y,
                assignmentsBlock.AssignmentBottomRows,
                achievedScoresRow,
                gradesRow,
                studentNamesBlock.MostOuterColumn);

            borderBlock.Write(spreadsheetWriter);
        }