Sha256: 7b8f13ca21a816f1fb634297dcf7755beaf16daf3f642cb52b3b6a2341987498

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

. $PSScriptRoot\..\..\support\hyperv.ps1

describe 'New-DifferencingDisk' {
  mock new-vhd -Verifiable -MockWith {}

  context 'mandatory parameters' {
    mock Test-Path -MockWith {}

    $command = get-command new-differencingDisk

    it 'Path is mandatory' {
      $Command.Parameters['Path'].Attributes.Mandatory | should be $true
    }
    it 'ParentPath is mandatory' {
      $Command.Parameters['ParentPath'].Attributes.Mandatory | should be $true
    }
  }

  context 'when differencing disk exists' {
    mock Test-Path -ParameterFilter {$Path -eq 'c:\.kitchen\diff.vhd'} -MockWith {$true}

    new-differencingDisk -Path 'c:\.kitchen\diff.vhd' -parentpath 'c:\source.vhd'

    it 'does not create a new vhd' {
      Assert-MockCalled new-vhd -Times 0
    }
  }

  context 'when a differencing disk does not exist' {
    mock Test-Path -ParameterFilter {$Path -eq 'c:\.kitchen\diff.vhd'} -MockWith {$false}

    new-differencingDisk -Path 'c:\.kitchen\diff.vhd' -parentpath 'c:\source.vhd'

    it 'creates a new differencing disk' {
      Assert-MockCalled new-vhd -Times 1 -ParameterFilter {
        $Path -eq 'c:\.kitchen\diff.vhd' -and 
        $ParentPath -eq 'c:\source.vhd' -and 
        $Differencing -eq $true
      }
    }
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kitchen-hyperv-0.3.0 spec/support/hyperv.Tests.ps1