-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility moduleWG-Quality-Testissues in a test or in test infrastructureissues in a test or in test infrastructure
Description
NOTE: See also #7591
Steps to reproduce
Start-PSPester -Path ./test/powershell/Modules/Microsoft.PowerShell.Utility/Send-MailMessage.tests.ps1Expected behavior
The tests pass.
Actual behavior
The tests fails with the error 'A null key is not allowed in a hash literal'
The cause of the failure is the SmtpServer part of the hash table that is piped to Send-MailMessage. Note the '$' before the SmtpServer hash key. This is resolving to an empty string.
$object = [PSCustomObject]@{"To" = $address; "From" = $address; "Subject" = $subject; "Body" = $body; $SmtpServer = '127.0.0.1'}
The fix is to remove the $ from $SmtpServer. Also, the quotes around the other keys are not needed.
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility moduleWG-Quality-Testissues in a test or in test infrastructureissues in a test or in test infrastructure