public void Write_WithAssignments_SavesLastRowOfEachAssignment() { // Arrange int questionNamesColumns = 2; var assignments = new List <Assignment> { new Assignment(3), new Assignment(1) }; var sut = new AssignmentsBlock(_startpoint, assignments, questionNamesColumns); // Act sut.Write(_spreadsheetWriter); // Assert int headerOffset = 1; sut.AssignmentBottomRows.Should().HaveCount(assignments.Count); sut.AssignmentBottomRows.Should().HaveCount(assignments.Count); int firstAssignmentRow = sut.AssignmentBottomRows.ElementAt(0); firstAssignmentRow.Should().Be(headerOffset + 2); int secondAssignmentRow = sut.AssignmentBottomRows.ElementAt(1); secondAssignmentRow.Should().Be(headerOffset + 3); }
public void Write_WithAssignments_PutsHeaderOnRightPosition() { // Arrange int expectedQuestionNamesColumns = 2; var assignments = new List <Assignment> { }; var sut = new AssignmentsBlock(_startpoint, assignments, expectedQuestionNamesColumns); // Act sut.Write(_spreadsheetWriter); // Assert _spreadsheet[0, 0].Should().Be("Opgave"); _spreadsheet[expectedQuestionNamesColumns, 0].Should().Be("Punten"); SpreadsheetTestUtilities.PrintArraySpreadsheet(_spreadsheet); }
public void Write_WithAssignment_SavesLastRowOfAssignment() { // Arrange int questionNamesColumns = 2; int numberOfQuestions = 3; var assignments = new List <Assignment> { new Assignment(numberOfQuestions) }; var sut = new AssignmentsBlock(_startpoint, assignments, questionNamesColumns); // Act sut.Write(_spreadsheetWriter); // Assert sut.AssignmentBottomRows.Should().ContainSingle(); var actualStartRow = sut.AssignmentBottomRows.Single(); actualStartRow.Should().Be(3); }
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); }