Skip to content

Make Headers and Rows public properties with cache clearing, add AddRows method#14

Merged
BrunoVT1992 merged 10 commits intodevelopfrom
copilot/make-headers-rows-public-fields
Dec 7, 2025
Merged

Make Headers and Rows public properties with cache clearing, add AddRows method#14
BrunoVT1992 merged 10 commits intodevelopfrom
copilot/make-headers-rows-public-fields

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

  • Make Headers property public with private backing field _headers and setter that clears cache
  • Make Rows property public with private backing field _rows and setter that clears cache
  • Add AddRows method that allows adding multiple rows at once
  • Update existing unit tests if needed
  • Add unit tests for new Headers property (5 tests)
  • Add unit tests for new Rows property (5 tests)
  • Add unit tests for new AddRows method (5 tests)
  • Build and verify all tests pass (46 tests passing)
  • Run code review and address feedback (reviewed - existing design is intentional)
  • Run security scan (CodeQL - no alerts)
  • Address PR feedback:
    • Updated Headers property summary to indicate it's a single optional top row
    • Updated AddRows to init Rows list when null
    • Updated all unit tests to use ToTable() instead of ToString()
    • Allow empty rows in AddRows (removed ?.Any() check)
    • Added null check for _rows in AddRow method
    • Added simple ToString unit test
    • Renamed unit tests to match the functions being tested (ToString_ -> ToTable_)
Original prompt

Make the headers and rows property public fields with backing private foelds and in the setter clear the cache. Also make an extra method AddRows thatvallows for multiple rows to be added. Also update the uni tests .


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ows method, and add unit tests

Co-authored-by: BrunoVT1992 <8803153+BrunoVT1992@users.noreply.github.com>
{
private string[] _headers;
/// <summary>
/// Gets or sets the headers of the table
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add to the summary that this is a single optional top row

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the summary to: "Gets or sets the headers of the table. This is a single optional top row." (74246ec)

/// </summary>
public Table AddRows(params string[][] rows)
{
if (rows != null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use the ?.Any method. Also init the Rows list when it is null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use rows?.Any() == true and added null check to initialize _rows if null. (74246ec)

Copy link
Owner

@BrunoVT1992 BrunoVT1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the ToTable method in all the unit tests instead of the .ToString

Copilot AI changed the title [WIP] Make headers and rows properties public with cache clearing Make Headers and Rows public properties with cache clearing, add AddRows method Dec 2, 2025
Copilot AI requested a review from BrunoVT1992 December 2, 2025 12:21
…use ToTable() in tests

Co-authored-by: BrunoVT1992 <8803153+BrunoVT1992@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

Use the ToTable method in all the unit tests instead of the .ToString

Updated all unit tests to use ToTable() instead of ToString(). (74246ec)

/// </summary>
public Table AddRows(params string[][] rows)
{
if (rows?.Any() == true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Adding an emty row is allowed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the ?.Any() check so empty rows are allowed. Now only checks for null on the rows parameter. (f5cae2d)

Copy link
Owner

@BrunoVT1992 BrunoVT1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add 1 simple unit test for ToString.
In the AddRow method check if _rows is null init the list.

Co-authored-by: BrunoVT1992 <8803153+BrunoVT1992@users.noreply.github.com>
Co-authored-by: BrunoVT1992 <8803153+BrunoVT1992@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

Add 1 simple unit test for ToString.
In the AddRow method check if _rows is null init the list.

Added a simple ToString unit test and added null check for _rows in the AddRow method. (5286a5d)

Copy link
Owner

@BrunoVT1992 BrunoVT1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check and rename each unit test name. According to the functions bwing trsted .

…oTable_)

Co-authored-by: BrunoVT1992 <8803153+BrunoVT1992@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

Check and rename each unit test name. According to the functions bwing trsted .

Renamed unit test methods that were calling ToTable() from ToString_* to ToTable_* to match the functions being tested. (3a888dd)

@BrunoVT1992 BrunoVT1992 marked this pull request as ready for review December 7, 2025 19:16
@BrunoVT1992 BrunoVT1992 merged commit 5604e2a into develop Dec 7, 2025
2 checks passed
@BrunoVT1992 BrunoVT1992 deleted the copilot/make-headers-rows-public-fields branch December 7, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants