public void Write_WithStudents_SortStudentNamesOnLastName() { // Arrange var students = new List <Student> { new Student(Name.CreateFromString("-"), null, Name.CreateFromString("Z")), new Student(Name.CreateFromString("-"), null, Name.CreateFromString("A")) }; var sut = new StudentNamesBlock(_startpoint, students, 2); // Act sut.Write(_spreadsheetWriter); // Assert _spreadsheet[0, 0].Should().Contain("A"); }
public void Write_WithStudents_PutsStudentNamesInRow() { // Arrange var students = _fixture.CreateMany <Student>() .OrderBy(x => x.LastName.Value); var sut = new StudentNamesBlock(_startpoint, students, 2); // Act sut.Write(_spreadsheetWriter); // Assert for (int i = 0; i < students.Count(); i++) { var expectedStudent = students.ElementAt(i); var expectedName = $"{expectedStudent.FirstName.Value} {expectedStudent.Infix} {expectedStudent.LastName.Value}"; _spreadsheet[i, 0].Should().Be(expectedName); } }
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); }