Skip to content

Instantly share code, notes, and snippets.

@PlagueHO
Created December 23, 2015 06:03
Show Gist options
  • Save PlagueHO/83a33073d9e29ccf35af to your computer and use it in GitHub Desktop.
Save PlagueHO/83a33073d9e29ccf35af to your computer and use it in GitHub Desktop.
Example DSC Unit Test an exception
Context 'Virtual Disk exists and should but has a different ParentPath' {
Mock Get-iSCSIVirtualDisk -MockWith { return @($MockVirtualDisk) }
It 'should throw an exception' {
{ Test-TargetResource @Splat } | Should Throw
}
It 'should call expected Mocks' {
Assert-MockCalled -commandName Get-iSCSIVirtualDisk -Exactly 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment