NOTE: See also #7591
Steps to reproduce
Start-PSPester -Path ./test/powershell/Modules/Microsoft.PowerShell.Utility/Send-MailMessage.tests.ps1
Expected 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.
NOTE: See also #7591
Steps to reproduce
Expected 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.