- Fix the scripts used for `Copy-Item -FromSessoin/-ToSession` and `PSEdit`. They use `-Encoding Byte`, which only works in PS5.1. In PS 7+, we need to use `-AsByteStream` instead. So, those scenarios (copy alternate data stream to/from remote PS 7 session and edit file from a remote PS 7 session) have been broken for a long time.
- The remote tests for `Copy-Item` have always been disabled. This PR re-enables those tests for Windows (the `HelperRemoting` module only works on Windows).
This fixes test isolation issues where six test files were leaking $PSDefaultParameterValues["It:Skip"] settings to subsequent tests, causing widespread test skipping on Linux. The fixes address two distinct patterns: using .Remove() which doesn't restore the original state (4 files), and imbalanced Push-DefaultParameterValueStack/Pop-DefaultParameterValueStack calls (2 files).
* Added verbose TCP test logic
* Cleaned up output, removed source IP address
* Consolidated detailed output logic into ProcessConnectionByTCPPort()
* Updated existing tests with -Quiet switch
* Improved output formatting, changed logic to match
* Error handling and logic improvements
* Updated tests to match new output
* Updated logic, tcp tests now run once by default
* Moved TcpConnectionTestResult enum into TcpTestStatus class
* Removed unnecessary whitespace
* Wrapped TcpClient() in Using statement
* Appended missing period on comments
* Change TcpTestStatus to TcpPortStatus for better clarity
* Set default count back to 4
* Move stopwatch reset into finally block
* Change TcpConnectionTestResult.New to TcpConnectionTestResult.None
* Formatting fixes
* Increase column size for Result output
* Update logic for -quiet option
* Change "TestNum" property to "Id"
* Change Destination and DestinationAddress to Target and TargetAddress in TcpPortStatus
* Implement new form of using declaration
* Fix indentation
* Update output, improve logic and update tests
* Add CancellationToken to allow cancel before timeout
* Assign testResult.Connected to client.Connected
* Move TcpPortStatus object creation to after connection test
* Remove delay from final connection test in loop
* Move Count logic from ProcessConnectionByTCPPort into own function
* Fix small formatting error
* Add handling for TaskCanceledException
* Remove redundant CancellationToken getter
* Clean up handling of SocketException
* Increase readability of final loop check
* Remove unnecessary TimeSpan invocation
* Rename cancellationTokenSource to match convention
* Move SetCountForTcpTest() into BeginProcessing()
* Added nameof to Count check
* Removed explicit type declaration for TcpClient
* Move delay and timeout evaluation out of the cycle
* Remove redundant CancellationTokenSource
* Initialize detailed SwitchParameter
* Add check for Detailed parameter
* Remove redundant tests for non-detailed output
* Add return after first boolean output
* Update tests with new detailed parameter set
---------
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
* Add `-Environment` parameter to `Start-Process`
* address codefactor
* fix test for Windows
* handle case where value is $null to remove env var
* change variables to make it more clear what the test is doing