Skip to content

Code Coverage for DownloadFile Review 1St - #12486

Open
paul1956 wants to merge 125 commits into
dotnet:mainfrom
paul1956:Code-Coverage-Network-Download-Review-1St
Open

Code Coverage for DownloadFile Review 1St#12486
paul1956 wants to merge 125 commits into
dotnet:mainfrom
paul1956:Code-Coverage-Network-Download-Review-1St

Conversation

@paul1956

@paul1956 paul1956 commented Nov 14, 2024

Copy link
Copy Markdown
Contributor

Replace corrupt PR12221

Proposed changes

  • Code Coverage for DownloadFile

Customer Impact

  • This adds code coverage for DownloadFile which will be required to replace obsolete WebClient.

Regression?

  • No

Risk

-None

Test environment(s)

Microsoft Reviewers: Open in CodeFlow

@paul1956
paul1956 requested a review from a team as a code owner November 14, 2024 19:22
@codecov

codecov Bot commented Nov 14, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.56175% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.34276%. Comparing base (6d20991) to head (6e9ca2b).
⚠️ Report is 143 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12486         +/-   ##
===================================================
+ Coverage   77.15155%   77.34276%   +0.19120%     
===================================================
  Files           3278        3285          +7     
  Lines         645199      648349       +3150     
  Branches       47716       47895        +179     
===================================================
+ Hits          497781      501451       +3670     
+ Misses        143724      143200        -524     
- Partials        3694        3698          +4     
Flag Coverage Δ
Debug 77.34276% <97.56175%> (+0.19120%) ⬆️
integration 18.98929% <ø> (-0.00036%) ⬇️
production 52.22702% <ø> (+0.20664%) ⬆️
test 97.40849% <97.56175%> (+0.00185%) ⬆️
unit 49.66504% <ø> (+0.20142%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KlausLoeffelmann

Copy link
Copy Markdown
Member

Is this meant as the "security net" for the current API, so should we switch, we know it did not regress?

@KlausLoeffelmann KlausLoeffelmann self-assigned this Oct 25, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 comprehensive test coverage for the DownloadFile functionality in Microsoft.VisualBasic.Forms, which will eventually replace the obsolete WebClient. The changes include new test infrastructure, extensive test cases for both download and upload scenarios, and supporting utility classes for server configuration and test data management.

Key Changes

  • Added complete test suite for DownloadFile functionality with 1,722 lines of tests covering various scenarios including authentication, timeout, and file handling
  • Created supporting test infrastructure including WebListener, ServerConfiguration, and helper utilities for managing test files and verifying downloads
  • Added test coverage for UploadFile functionality with 1,472 lines of tests
  • Introduced new localized resource strings for web status errors (NotFound, Timeout, Unauthorized)

Reviewed Changes

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

Show a summary per file
File Description
DownloadFileTests.vb Comprehensive test suite for DownloadFile functionality covering URI/URL variants, authentication, timeout, overwrite scenarios
UploadFileTests.vb Complete test coverage for UploadFile with authentication, error handling, and various parameter combinations
WebListener.vb Test utility class that implements HTTP listener for simulating download/upload server operations
ServerConfiguration.vb Configuration management for test server settings with JSON serialization support
DownloadFileVerifiers.vb Helper module providing verification methods for successful and failed download operations
DownloadFileTestConstants.vb Centralized test constants for URLs, passwords, and timeout values
EnumFileSizes.vb Enum defining standard file sizes used across tests
PrivateSetterContractResolver.vb JSON serialization helper for handling properties with private setters
VbFileCleanupTestBase.vb Updated CreateTempFile to use FileSizes enum and improved documentation formatting
FileSystemProxyTests.vb Updated to use FileSizes enum instead of integer literals
ServerConfigurationTests.vb Tests for server configuration serialization and deserialization
SR.resx and xlf files Added new localized resource strings for web status error messages
Winforms.sln Removed DemoConsole project reference


''' <summary>
''' Parses a <see cref="HttpListenerRequest"/> and gets the fileName of the uploaded file
''' and the lenght of the data file in bytes

Copilot AI Oct 25, 2025

Copy link

Choose a reason for hiding this comment

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

Corrected spelling of 'lenght' to 'length'.

Suggested change
''' and the lenght of the data file in bytes
''' and the length of the data file in bytes

Copilot uses AI. Check for mistakes.
Comment on lines +265 to +269
''' and the lenght of the data file in bytes
''' </summary>
''' <param name="request"></param>
''' <returns>
''' A <see cref="Dictionary(Of String, String)"/> that contains the filename and lenght of the data file.

Copilot AI Oct 25, 2025

Copy link

Choose a reason for hiding this comment

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

Corrected spelling of 'lenght' to 'length'.

Suggested change
''' and the lenght of the data file in bytes
''' </summary>
''' <param name="request"></param>
''' <returns>
''' A <see cref="Dictionary(Of String, String)"/> that contains the filename and lenght of the data file.
''' and the length of the data file in bytes
''' </summary>
''' <param name="request"></param>
''' <returns>
''' A <see cref="Dictionary(Of String, String)"/> that contains the filename and length of the data file.

Copilot uses AI. Check for mistakes.
End If
Dim filenameWithPath As String = Path.Join(sourceDirectoryName, filename)

If size >= 0 Then

Copilot AI Oct 25, 2025

Copy link

Choose a reason for hiding this comment

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

The condition size >= 0 is inconsistent with the updated enum type FileSizes. The comparison should check against FileSizes.Unknown instead of comparing to an integer literal, since size is now of type FileSizes.

Suggested change
If size >= 0 Then
If size <> FileSizes.Unknown Then

Copilot uses AI. Check for mistakes.
@KlausLoeffelmann KlausLoeffelmann added 🚧 work in progress Work that is current in progress area-VisualBasic labels Oct 25, 2025
@KlausLoeffelmann KlausLoeffelmann added this to the .NET 11 milestone Oct 25, 2025
@KlausLoeffelmann

Copy link
Copy Markdown
Member

@LeafShi1 - anybody of you able to do a review?
I know it's VB.
But, I can't currently spend much time with this.

@copilot: Could you create an evaluation list of issues we should take a closer look on? Create a Markdown Todo list in a comment, which could serve as the template for an issue. Be very thorough, but not nit-picky.

@paul1956

paul1956 commented Oct 25, 2025 via email

Copy link
Copy Markdown
Contributor Author

@paul1956

paul1956 commented Oct 25, 2025 via email

Copy link
Copy Markdown
Contributor Author

@KlausLoeffelmann

Copy link
Copy Markdown
Member

I am wondering, if it makes sense, to now, as the mechanical maintenance has already been done in a separate PR, to create a new one, with just the changes relevant to what's left for the actual unit tests.

The Commits would pretty much polute the history.

Are the changes for the actual tests pretty central?

@paul1956

paul1956 commented Oct 25, 2025 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VisualBasic 🚧 work in progress Work that is current in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants