1- $commandname = $MyInvocation.MyCommand.Name.Replace (" .Tests.ps1" , " " )
1+ $moduleRoot = (Resolve-Path " $PSScriptRoot \..\.." ).Path
2+ $commandname = $MyInvocation.MyCommand.Name.Replace (" .Tests.ps1" , " " )
23$rootPath = Split-Path (Split-Path $PSScriptRoot - Parent) - Parent
34
4- Write-Host - Object " Running $PSCommandpath " - ForegroundColor Cyan
5-
65. " $rootPath \tests\constants.ps1"
76
87Describe " $commandname Unit Tests" {
@@ -11,27 +10,26 @@ Describe "$commandname Unit Tests" {
1110 # Get a random value for the database name
1211 $random = Get-Random
1312
14- $filename = " Test_VHD_$ ( $random ) .vhdx"
1513 $name = " Test_VHD_$ ( $random ) "
16- $destination = " $rootPath \tests"
17- $path = " $destination \$filename "
14+ $destination = " $moduleRoot \tests"
15+ $path = " $destination \$name .vhdx "
1816 }
1917
20- Context " Create VHD with file name" {
21- It - Skip " Should be successful" {
22- $null = New-PDCVhdDisk - Destination $destination - FileName " $name .vhdx"
18+ Context " Create VHD with -FileName parameter" {
19+ $null = New-PDCVhdDisk - Destination $destination - FileName " $name .vhdx"
2320
24- (Test-Path - Path $path ) | Should - Be $true
21+ It " Should be true" {
22+ (Test-Path - Path $path ) | Should Be $true
2523 }
2624
2725 Remove-Item - Path $path - Force
2826 }
2927
30- Context " Create VHD with name" {
31- It - Skip " Should be successful" {
32- $null = New-PDCVhdDisk - Destination $destination - Name $name
28+ Context " Create VHD with -Name parameter" {
29+ $null = New-PDCVhdDisk - Destination $destination - Name $name
3330
34- (Test-Path - Path $path ) | Should - Be $true
31+ It " Should be true" {
32+ (Test-Path - Path $path ) | Should Be $true
3533
3634 }
3735
0 commit comments