Skip to content

Add caching property and method#16

Merged
BrunoVT1992 merged 2 commits intomasterfrom
develop
Dec 8, 2025
Merged

Add caching property and method#16
BrunoVT1992 merged 2 commits intomasterfrom
develop

Conversation

@BrunoVT1992
Copy link
Owner

No description provided.

@BrunoVT1992 BrunoVT1992 requested a review from Copilot December 8, 2025 09:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a caching mechanism to the Table class to improve performance when generating table strings multiple times. The change introduces a property to toggle caching and a method to manually clear the cache.

Key changes:

  • Added CachingEabled property (default: true) to enable/disable table string caching
  • Made ClearCache() method public and added fluent interface return type
  • Updated cache logic to respect the new caching property

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
ConsoleTable.Text/Table.cs Implements caching property with getter/setter and updates ToTable() method to conditionally cache results
Tests/ConsoleTable.Text.Tests/TableTests.cs Adds test coverage for caching functionality including performance test and behavior verification
README.md Documents the new CachingEabled property and ClearCache() method
ChangeLogs/1.0.3-ChangeLog.md Documents the new feature in version 1.0.3 changelog
ConsoleTable.Text.Examples/Program.cs Demonstrates usage by explicitly setting CachingEabled to true
ConsoleTable.slnx Adds reference to the new changelog file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BrunoVT1992 BrunoVT1992 requested a review from Copilot December 8, 2025 09:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[Theory]
[InlineData(true)]
[InlineData(false)]
public void PerformanceCheck(bool cacheEnabled)
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The test method name 'PerformanceCheck' is unclear about what it's verifying. Consider renaming to something more specific like 'ToTable_WithDifferentCachingSettings_GeneratesTableSuccessfully' to clarify that this is a functional test rather than a performance benchmark.

Suggested change
public void PerformanceCheck(bool cacheEnabled)
public void ToTable_WithDifferentCachingSettings_GeneratesTableSuccessfully(bool cacheEnabled)

Copilot uses AI. Check for mistakes.
}

[Fact]
public void ClearCache()
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The test method name 'ClearCache' conflicts with the method being tested. Rename to follow the test naming pattern used elsewhere in the file, such as 'ClearCache_AfterCaching_AllowsTableRegenerationWithSameContent'.

Suggested change
public void ClearCache()
public void ClearCache_AfterCaching_AllowsTableRegenerationWithSameContent()

Copilot uses AI. Check for mistakes.
[Theory]
[InlineData(true)]
[InlineData(false)]
public void CachingEnabled(bool cachingEnabled)
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The test method name 'CachingEnabled' conflicts with the property being tested. Rename to follow the test naming pattern used elsewhere in the file, such as 'CachingEnabled_WithTrueOrFalse_GeneratesTableSuccessfully'.

Suggested change
public void CachingEnabled(bool cachingEnabled)
public void CachingEnabled_WithTrueOrFalse_ReturnsTableContainingRow(bool cachingEnabled)

Copilot uses AI. Check for mistakes.
@BrunoVT1992 BrunoVT1992 merged commit 80458e2 into master Dec 8, 2025
2 checks passed
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