Conversation
Added new `Console` property . Simplified logic. Updated `WithDebugMode` (this will be renamed)
… and `TestConsoleTests.cs` to validate the behavior of the `ConsoleProgressBar` class and its interaction with `ConsoleTest` and `ConsoleReal`.
Added specific tests for `ConsoleInterceptor`.
Simplified code by removing untestable/unreachable code-paths.
…ts.cs` to validate the behavior of the `ConsoleProgressHandler` across various scenarios. New tests have been added for handling empty collections, queryable collections, and enumerator variants.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances test coverage for the console progress bar library by adding comprehensive tests for new console abstraction interfaces and improving testability through dependency injection patterns.
- Introduces console abstraction layer with
IConsole,ConsoleReal, andConsoleTestclasses - Refactors from debug flag approach to proper console injection for better testability
- Adds extensive test coverage for console interceptor, console test implementations, and progress proxy extensions
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ConsoleInterceptor.cs | New utility class moved to TestTools namespace for capturing console output during tests |
| TestConsoleTests.cs | Comprehensive test suite for ConsoleTest class covering all console abstraction methods |
| ProgressProxyExtensionsTests.cs | Tests for progress proxy extension methods including console abstraction verification |
| ConsoleProgressHandlerTests.cs | Enhanced with additional test scenarios for empty collections, queryable support, and enumerator variants |
| ConsoleInterceptorTests.cs | New test file for thorough testing of console interception functionality |
| ProgressProxyExtensions.cs | Refactored from WithDebugMode to WithTestMode using proper console injection |
| ProgressProxy.cs | Major refactoring to support console injection and improved progress calculation logic |
| IConsole.cs | New interface defining console abstraction contract |
| ConsoleTest.cs | Test implementation of console interface for unit testing scenarios |
| ConsoleReal.cs | Production implementation wrapping actual System.Console |
| ConsoleProgressHandler.cs | Refactored to use injected console interface instead of static Console calls |
Comments suppressed due to low confidence (2)
ConsoleProgressBar/ConsoleProgressBarTests/TestConsoleTests.cs:9
- The class name 'TestConsoleTests' is confusing as it contains 'Test' twice. Consider renaming to 'ConsoleTestTests' to better reflect that it tests the ConsoleTest class.
public sealed class TestConsoleTests
ConsoleProgressBar/ConsoleProgressBarTests/ConsoleProgressHandlerTests.cs:616
- Variable name 'blah' is not descriptive. Consider renaming to something more meaningful like 'progressProxy' or 'sut' (subject under test).
ProgressProxy<int> blah = fnFooBar()
only publish on `push`, not `pull_request`
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
No description provided.