This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data LocalizedData | |
{ | |
# culture="en-US" | |
ConvertFrom-StringData -StringData @' | |
GettingiSCSIVirtualDiskMessage=Getting iSCSI Virtual Disk "{0}". | |
iSCSIVirtualDiskExistsMessage=iSCSI Virtual Disk "{0}" exists. | |
iSCSIVirtualDiskDoesNotExistMessage=iSCSI Virtual Disk "{0}" does not exist. | |
SettingiSCSIVirtualDiskMessage=Setting iSCSI Virtual Disk "{0}". | |
EnsureiSCSIVirtualDiskExistsMessage=Ensuring iSCSI Virtual Disk "{0}" exists. | |
EnsureiSCSIVirtualDiskDoesNotExistMessage=Ensuring iSCSI Virtual Disk "{0}" does not exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-LocalizedData -BindingVariable LocalizedData -Filename BMD_cMyNewResource.psd1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Verbose -Message ($LocalizedData.iSCSIVirtualDiskExistsMessage -f $Path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context 'Virtual Disk exists and should but has a different Description' { | |
Mock Get-iSCSIVirtualDisk -MockWith { return @($MockVirtualDisk) } | |
Mock New-iSCSIVirtualDisk | |
Mock Set-iSCSIVirtualDisk | |
Mock Remove-iSCSIVirtualDisk | |
It 'should not throw error' { | |
{ | |
$Splat = $TestVirtualDisk.Clone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context 'Virtual Disk does not exist but should' { | |
Mock Get-iSCSIVirtualDisk | |
Mock New-iSCSIVirtualDisk | |
Mock Set-iSCSIVirtualDisk | |
Mock Remove-iSCSIVirtualDisk | |
It 'should not throw error' { | |
{ | |
$Splat = $TestVirtualDisk.Clone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context 'Virtual Disk exists but should not' { | |
Mock Get-iSCSIVirtualDisk -MockWith { return @($MockVirtualDisk) } | |
Mock New-iSCSIVirtualDisk | |
Mock Set-iSCSIVirtualDisk | |
Mock Remove-iSCSIVirtualDisk | |
It 'should not throw error' { | |
{ | |
$Splat = $TestVirtualDisk.Clone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context 'Virtual Disk does not exist and should not' { | |
Mock Get-iSCSIVirtualDisk | |
Mock New-iSCSIVirtualDisk | |
Mock Set-iSCSIVirtualDisk | |
Mock Remove-iSCSIVirtualDisk | |
It 'should not throw error' { | |
{ | |
$Splat = $TestVirtualDisk.Clone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context 'Virtual Disk exists and should but has a different Description' { | |
Mock Get-iSCSIVirtualDisk -MockWith { return @($MockVirtualDisk) } | |
It 'should return false' { | |
{ | |
$Splat = $TestVirtualDisk.Clone() | |
$Splat.Description = 'Different' | |
Test-TargetResource @Splat | Should Be $False | |
} | Should Not Throw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context 'Virtual Disk does not exist but should' { | |
Mock Get-iSCSIVirtualDisk | |
It 'should return false' { | |
$Splat = $TestVirtualDisk.Clone() | |
Test-TargetResource @Splat | Should Be $False | |
} | |
It 'should call expected Mocks' { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-VirtualDisk { | |
param | |
( | |
[parameter(Mandatory = $true)] | |
[System.String] | |
$Path | |
) | |
try | |
{ | |
$VirtualDisk = Get-iSCSIVirtualDisk ` |