Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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