Skip to content

Commit

Permalink
Fix order in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Jun 7, 2022
1 parent ba0ff12 commit 61954c1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Tests/Send-EmailMessage.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
}

$Output = Send-EmailMessage @sendEmailMessageSplat -ErrorAction Stop

$Output.Status | Should -Be $false
$Output.Error | Should -Be 'Email not sent (WhatIf)'
$Output.SentTo | Should -Be '[email protected], [email protected]'
$Output.SentFrom.Email | Should -Be '[email protected]'
$Output.SentFrom.Name | Should -Be 'Przemysław Kłys'
$Output.Message | Should -Be $null
$Output.Server | Should -Be 'smtp.office365.com'
$Output.Port | Should -Be '587'
$Output.Status | Should -Be $false
}
It 'Send email using given parameters (Graph)' {
# Credentials for Graph
Expand All @@ -47,24 +46,21 @@
DoNotSaveToSentItems = $true
WhatIf = $true
}

$GraphOutput.Status | Should -Be $False
$GraphOutput = Send-EmailMessage @sendEmailMessageSplat
$GraphOutput.Error | Should -Be 'Email not sent (WhatIf)'
$GraphOutput.SentTo | Should -Be '[email protected]'
$GraphOutput.SentFrom | Should -Be '[email protected]'
$GraphOutput.Message | Should -Be ''

$GraphOutput = Send-EmailMessage @sendEmailMessageSplat

$GraphOutput.Status | Should -Be $False
}
It 'Send email using given parameters (SMTP no TLS, no login/password)' {
$Output = Send-EmailMessage -From '[email protected]' -To '[email protected]' -Server 'smtp.freesmtpservers.com' -Port 25 -Body 'test me 🤣😍😒💖✨🎁 Przemysław Kłys' -Subject '😒💖 This is another test email 我' -Verbose
$Output.Status | Should -Be $true
$Output.Error | Should -Be ''
$Output.SentTo | Should -Be '[email protected]'
$Output.SentFrom | Should -Be '[email protected]'
$Output.Message | Should -Be 'OK'
$Output.Server | Should -Be 'smtp.freesmtpservers.com'
$Output.Port | Should -Be 25
$Output.Status | Should -Be $true
}
}

0 comments on commit 61954c1

Please sign in to comment.