Пример #1
0
        public void Write_WithMultipleStudents_PutsSUMFormulaOnAllScoresOfStudents()
        {
            // Arrange
            var scoreTopPoint    = new Point(1, 0);
            int numberOfStudents = 3;
            var sut = new TotalScoresBlock(
                _startpoint,
                scoreTopPoint,
                numberOfStudents);

            // Act
            sut.Write(_spreadsheetWriter);

            // Assert
            SpreadsheetTestUtilities.PrintArraySpreadsheet(_spreadsheet);
            _spreadsheet[1, 0].Should().Be("StartStandardFormulaSUM");
            _spreadsheet[1, 4].Should().Be("EndStandardFormulaSUM");
            _spreadsheet[1, 5].Should().Be("Result of StandardFormulaSUM");

            _spreadsheet[2, 0].Should().Be("StartStandardFormulaSUM");
            _spreadsheet[2, 4].Should().Be("EndStandardFormulaSUM");
            _spreadsheet[2, 5].Should().Be("Result of StandardFormulaSUM");

            _spreadsheet[3, 0].Should().Be("StartStandardFormulaSUM");
            _spreadsheet[3, 4].Should().Be("EndStandardFormulaSUM");
            _spreadsheet[3, 5].Should().Be("Result of StandardFormulaSUM");

            _spreadsheet[4, 0].Should().Be("StartStandardFormulaSUM");
            _spreadsheet[4, 4].Should().Be("EndStandardFormulaSUM");
            _spreadsheet[4, 5].Should().Be("Result of StandardFormulaSUM");
        }
Пример #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");
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        public void Write_WithAverages_PutsAverageGradeTitleOnRightPosition()
        {
            // Arrange
            var sut = new StatisticsBlock(
                _startpoint,
                0,
                1,
                2,
                3);

            // Act
            sut.Write(_spreadsheetWriter);

            // Assert
            SpreadsheetTestUtilities.PrintArraySpreadsheet(_spreadsheet);
            _spreadsheet[0, 4].Should().Be("Gemiddelde cijfer");
        }
        public async Task CreateTestResultsSpreadsheetAsync_WithValidInput_CreatesSpreadsheet()
        {
            // Arrange
            var metadata = _fixture.Create <Application.Models.Spreadsheet.Metadata>();

            SetupSpreadsheetFileBuilder();
            FormulaBuilderTestUtilities.SetupFormulaBuilder(_formulaBuilder, _fixture.Create <string>());

            Class @class = _fixture.Create <Class>();
            Test  test   = new TestBuilder()
                           .WithNumberOfVersions(2)
                           .WithMinimumGrade(Grade.CreateFromByte(1))
                           .WithRandomAssignments()
                           .Build();

            // Act
            await _sut.CreateTestResultsSpreadsheetAsync(@class, test, metadata);

            // Assert
            SpreadsheetTestUtilities.PrintArraySpreadsheet(_spreadsheet);
        }