You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context "Testing Database Mail Profile exists on <_.Name>" {
101
101
It "The Database Mail profile <_.DatabaseMailProfile.ExpectedDatabaseMailProfile> exists on <_.Name>"-Skip:$skipDatabaseMailProfile { #-ForEach ($PSItem.DatabaseMailProfile | Where-Object ExpectedDatabaseMailProfile -NE 'null') {
102
-
$PSItem.DatabaseMailProfile.ActualDatabaseMailProfile| Should -Be$PSItem.DatabaseMailProfile.ExpectedDatabaseMailProfile-Because 'The database mail profile is required to send emails'
102
+
$PSItem.DatabaseMailProfile.ActualDatabaseMailProfile| Should -BeIn$PSItem.DatabaseMailProfile.ExpectedDatabaseMailProfile-Because 'The database mail profile is required to send emails'
103
103
}
104
104
}
105
105
}
106
106
107
+
Describe "Agent Mail Profile"-Tag AgentMailProfile, Agent -ForEach $InstancesToTest {
Context "esting SQL Agent Alert System database mail profile is set on <_.Name>" {
111
+
It "The SQL Server Agent Alert System has the mail profile <_.AgentMailProfile.ExpectedAgentMailProfile> enabled as profile on <_.Name>."-Skip:$skipAgentMailProfile { #-ForEach ($PSItem.DatabaseMailProfile | Where-Object ExpectedDatabaseMailProfile -NE 'null') {
112
+
$PSItem.AgentMailProfile.ActualAgentMailProfile| Should -Be $PSItem.AgentMailProfile.ExpectedAgentMailProfile-Because 'The SQL Agent Alert System needs an enabled database mail profile to send alert emails'
113
+
}
114
+
}
115
+
}
107
116
108
-
# Describe "Database Mail Profile" -Tags DatabaseMailProfile, $filename {
109
-
# if ($NotContactable -contains $psitem) {
110
-
# Context "Testing database mail profile is set on $psitem" {
111
-
# It "Can't Connect to $Psitem" {
112
-
# $false | Should -BeTrue -Because "The instance should be available to be connected to!"
113
-
# }
114
-
# }
115
-
# }
116
-
# else {
117
-
# Context "Testing database mail profile is set on $psitem" {
# It "The Database Mail profile $databasemailprofile exists on $psitem" {
120
-
# ((Get-DbaDbMailProfile -SqlInstance $InstanceSMO).Name -contains $databasemailprofile) | Should -Be $true -Because 'The database mail profile is required to send emails'
121
-
# }
122
-
# }
123
-
# }
124
-
# }
125
117
126
-
# Describe "Agent Mail Profile" -Tags AgentMailProfile, $filename {
127
-
# if ($NotContactable -contains $psitem) {
128
-
# Context "Testing SQL Agent Alert System database mail profile is set on $psitem" {
129
-
# It "Can't Connect to $Psitem" {
130
-
# $false | Should -BeTrue -Because "The instance should be available to be connected to!"
131
-
# }
132
-
# }
133
-
# }
134
-
# else {
135
-
# Context "Testing SQL Agent Alert System database mail profile is set on $psitem" {
# It "The SQL Server Agent Alert System should have an enabled database mail profile on $psitem" {
138
-
# (Get-DbaAgentServer -SqlInstance $InstanceSMO).DatabaseMailProfile | Should -Be $agentmailprofile -Because 'The SQL Agent Alert System needs an enabled database mail profile to send alert emails'
0 commit comments