implement new Download-FileDirectly function to handle downloads
This commit is contained in:
@@ -9,7 +9,8 @@ $null = [Management.Automation.Language.Parser]::ParseFile($DsaScriptUnderTest,
|
||||
If ($DsaErrors.Count) { Throw ($DsaErrors | Out-String) }
|
||||
|
||||
Function Assert-Dsa { param([bool]$Condition, [string]$Description) If (!$Condition) { Throw $Description } }
|
||||
Function Download-File {
|
||||
Function Download-File { Throw 'DSA must use Download-FileDirectly.' }
|
||||
Function Download-FileDirectly {
|
||||
[CmdletBinding()]
|
||||
param($URL, $File)
|
||||
$script:DsaDownloadCalls++
|
||||
@@ -80,6 +81,7 @@ Function Invoke-DsaCase {
|
||||
Assert-Dsa ($script:DsaDownloadCalls -eq 0) 'Invalid flag must fail before downloading.'
|
||||
Return
|
||||
}
|
||||
Assert-Dsa ($script:DsaDownloadCalls -eq 1) 'Expected one direct download.'
|
||||
If ($Mode -in @('empty-download','download-failure')) {
|
||||
Assert-Dsa ($null -ne $DsaCaught) 'Download failure must stop collection.'
|
||||
Assert-Dsa ($script:DsaProcessCalls -eq 0 -and $script:DsaRecordedUploads.Count -eq 0) 'Download failure must prevent execution and upload.'
|
||||
|
||||
Reference in New Issue
Block a user