Skip to content

Commit

Permalink
Changes to test for xSQLAOGroupEnsure
Browse files Browse the repository at this point in the history
Fixed review comments
  • Loading branch information
johlju committed Sep 17, 2016
1 parent 59d7ad6 commit d517590
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions Tests/Unit/MSFT_xSQLAOGroupEnsure.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ try
Describe 'Get-TargetResource' {
Mock -CommandName Connect-SQL -MockWith {
# build a custom object to return which is close to the real SMO object
$smoObj = [PSCustomObject]@{
$smoObj = [PSCustomObject] @{
SQLServer = 'Node01'
SQLInstanceName = 'Prd01'
ClusterName = 'Clust01'
Expand All @@ -53,7 +53,7 @@ try
'AG01' = @{
AvailabilityGroupListeners = @{
name = 'AgList01'
availabilitygrouplisteneripaddresses = [System.Collections.ArrayList]@(@{IpAddress = '192.168.0.1'; SubnetMask = '255.255.255.0'})
availabilitygrouplisteneripaddresses = [System.Collections.ArrayList] @(@{IpAddress = '192.168.0.1'; SubnetMask = '255.255.255.0'})
portnumber = 5022
}

Expand Down Expand Up @@ -103,7 +103,7 @@ try
Describe 'Test-TargetResource' {
Mock -CommandName Connect-SQL -MockWith {
# build a custom object to return which is close to the real SMO object
$smoObj = [PSCustomObject]@{
$smoObj = [PSCustomObject] @{
SQLServer = 'Node01'
SQLInstanceName = 'Prd01'
ClusterName = 'Clust01'
Expand All @@ -114,7 +114,7 @@ try
'AG01' = @{
AvailabilityGroupListeners = @{
name = 'AgList01'
availabilitygrouplisteneripaddresses = [System.Collections.ArrayList]@(@{IpAddress = '192.168.0.1'; SubnetMask = '255.255.255.0'})
availabilitygrouplisteneripaddresses = [System.Collections.ArrayList] @(@{IpAddress = '192.168.0.1'; SubnetMask = '255.255.255.0'})
portnumber = 5022
}

Expand Down Expand Up @@ -193,16 +193,16 @@ try
Mock New-ListenerADObject -MockWith {} -ModuleName $script:DSCResourceName -Verifiable
Mock Get-ClusterNode -MockWith {
$clusterNode = @(
[PSCustomObject]@{
[PSCustomObject] @{
Name = 'Node01'
}
, [PSCustomObject]@{
},
[PSCustomObject] @{
Name = 'Node02'
}
, [PSCustomObject]@{
},
[PSCustomObject] @{
Name = 'Node03'
}
, [PSCustomObject]@{
},
[PSCustomObject] @{
Name = 'Node04'
}
)
Expand All @@ -211,7 +211,7 @@ try

Mock Connect-SQL -MockWith {
# build a custom object to return which is close to the real SMO object
$smoObj = [PSCustomObject]@{
$smoObj = [PSCustomObject] @{
SQLServer = 'Node01'
SQLInstanceName = 'Prd01'
ClusterName = 'Clust01'
Expand All @@ -222,7 +222,7 @@ try
'AG01' = @{
AvailabilityGroupListeners = @{
name = 'AgList01'
availabilitygrouplisteneripaddresses = [System.Collections.ArrayList]@(@{IpAddress = '192.168.0.1'; SubnetMask = '255.255.255.0'})
availabilitygrouplisteneripaddresses = [System.Collections.ArrayList] @(@{IpAddress = '192.168.0.1'; SubnetMask = '255.255.255.0'})
portnumber = 5022
}

Expand All @@ -247,19 +247,19 @@ try
Switch ($TypeName)
{
'Microsoft.SqlServer.Management.Smo.AvailabilityGroup' {
$object = [PSCustomObject]@{
$object = [PSCustomObject] @{
Name = "MockedObject"
AutomatedBackupPreference = ''
FailureConditionLevel = ''
HealthCheckTimeout = ''
AvailabilityReplicas = [System.Collections.ArrayList]@()
AvailabilityGroupListeners = [System.Collections.ArrayList]@()
AvailabilityReplicas = [System.Collections.ArrayList] @()
AvailabilityGroupListeners = [System.Collections.ArrayList] @()
}
$object | Add-Member -MemberType ScriptMethod -Name Create -Value {return $true}
}

'Microsoft.SqlServer.Management.Smo.AvailabilityReplica' {
$object = [PSCustomObject]@{
$object = [PSCustomObject] @{
Name = "MockedObject"
EndpointUrl = ''
FailoverMode = ''
Expand All @@ -271,15 +271,15 @@ try
}

'Microsoft.SqlServer.Management.Smo.AvailabilityGroupListener' {
$object = [PSCustomObject]@{
$object = [PSCustomObject] @{
Name = "MockedObject"
PortNumber = ''
AvailabilityGroupListenerIPAddresses = [System.Collections.ArrayList]@()
AvailabilityGroupListenerIPAddresses = [System.Collections.ArrayList] @()
}
}

'Microsoft.SqlServer.Management.Smo.AvailabilityGroupListenerIPAddress' {
$object = [PSCustomObject]@{
$object = [PSCustomObject] @{
Name = "MockedObject"
IsDHCP = ''
IPAddress = ''
Expand All @@ -288,7 +288,7 @@ try
}

Default {
$object = [PSCustomObject]@{
$object = [PSCustomObject] @{
Name = "MockedObject"
}
}
Expand Down

0 comments on commit d517590

Please sign in to comment.