Port test related style fixed from xPSDesiredStateConfiguration - Post Review #1

This commit is contained in:
Mike Hendrickson
2019-06-12 09:33:49 -07:00
parent 4bc47cf5bc
commit 187043254d
32 changed files with 623 additions and 622 deletions
@@ -65,8 +65,8 @@ try
Ensure = 'Present'
}
Test-GroupExists -GroupName $testGroupName1 | Should -Be $false
Test-GroupExists -GroupName $testGroupName2 | Should -Be $false
Test-GroupExists -GroupName $testGroupName1 | Should -BeFalse
Test-GroupExists -GroupName $testGroupName2 | Should -BeFalse
try
{
@@ -76,8 +76,8 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName1 -Members @() | Should -Be $true
Test-GroupExists -GroupName $testGroupName2 -Members @() | Should -Be $true
Test-GroupExists -GroupName $testGroupName1 -Members @() | Should -BeTrue
Test-GroupExists -GroupName $testGroupName2 -Members @() | Should -BeTrue
}
finally
{
@@ -105,7 +105,7 @@ try
MembersToInclude = $groupMembers
}
Test-GroupExists -GroupName $testGroupName1 | Should -Be $false
Test-GroupExists -GroupName $testGroupName1 | Should -BeFalse
try
{
@@ -115,7 +115,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName1 -MembersToInclude $groupMembers | Should -Be $true
Test-GroupExists -GroupName $testGroupName1 -MembersToInclude $groupMembers | Should -BeTrue
}
finally
{
@@ -140,8 +140,8 @@ try
MembersToInclude = $groupMembers
}
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $administratorsGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
Test-GroupExists -GroupName $administratorsGroupName | Should -BeTrue
try
{
@@ -151,8 +151,8 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName -MembersToInclude $groupMembers | Should -Be $true
Test-GroupExists -GroupName $administratorsGroupName -MembersToInclude $groupMembers | Should -Be $true
Test-GroupExists -GroupName $testGroupName -MembersToInclude $groupMembers | Should -BeTrue
Test-GroupExists -GroupName $administratorsGroupName -MembersToInclude $groupMembers | Should -BeTrue
}
finally
{
@@ -178,11 +178,11 @@ try
foreach ($testGroupName in $testGroupNames)
{
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
New-Group -GroupName $testGroupName -Members $testUsernames
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
}
try
@@ -195,7 +195,7 @@ try
foreach ($testGroupName in $testGroupNames)
{
Test-GroupExists -GroupName $testGroupName -MembersToExclude $groupMembersToExclude | Should -Be $true
Test-GroupExists -GroupName $testGroupName -MembersToExclude $groupMembersToExclude | Should -BeTrue
}
}
finally
@@ -222,11 +222,11 @@ try
foreach ($testGroupName in $testGroupNames)
{
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
New-Group -GroupName $testGroupName
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
}
try
@@ -239,7 +239,7 @@ try
foreach ($testGroupName in $testGroupNames)
{
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
}
}
finally
@@ -140,7 +140,7 @@ Describe 'Archive End to End Tests' {
$destination = Join-Path -Path $TestDrive -ChildPath 'NonExistentDestinationForExpand'
It 'Destination should not exist before configuration' {
Test-Path -Path $destination | Should -Be $false
Test-Path -Path $destination | Should -BeFalse
}
$archiveParameters = @{
@@ -151,7 +151,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -163,15 +163,15 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -199,7 +199,7 @@ Describe 'Archive End to End Tests' {
$otherItems[$otherFilePath] = $otherFileContent
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
foreach ($otherItemPath in $otherItems.Keys)
@@ -211,13 +211,13 @@ Describe 'Archive End to End Tests' {
if ($otherItemIsDirectory)
{
It "Other item under destination $otherItemName should exist as a directory before configuration" {
Test-Path -Path $otherItemPath -PathType 'Container' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Container' | Should -BeTrue
}
}
else
{
It "Other item under destination $otherItemName should exist as a file before configuration" {
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -BeTrue
}
It "Other file under destination $otherItemName should have the expected content before configuration" {
@@ -234,7 +234,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -246,11 +246,11 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
foreach ($otherItemPath in $otherItems.Keys)
@@ -262,13 +262,13 @@ Describe 'Archive End to End Tests' {
if ($otherItemIsDirectory)
{
It "Other item under destination $otherItemName should exist as a directory after configuration" {
Test-Path -Path $otherItemPath -PathType 'Container' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Container' | Should -BeTrue
}
}
else
{
It "Other item under destination $otherItemName should exist as a file after configuration" {
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -BeTrue
}
It "Other file under destination $otherItemName should have the expected after before configuration" {
@@ -278,7 +278,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -291,11 +291,11 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFilePath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
$archiveParameters = @{
@@ -306,7 +306,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -318,15 +318,15 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -339,15 +339,15 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFileWithDifferentFileContentPath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should not match the file contents of the archive' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeFalse
}
$archiveParameters = @{
@@ -361,7 +361,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and run configuration and throw an error for attempting to overwrite files without Force specified' {
@@ -374,19 +374,19 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should not match the file contents of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeFalse
}
It 'Should return false from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
}
@@ -399,15 +399,15 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFileWithDifferentFileContentPath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should not match the file contents of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeFalse
}
$archiveParameters = @{
@@ -421,7 +421,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -433,19 +433,19 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should match the file contents of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeTrue
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -458,15 +458,15 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFilePath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should match the file contents of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeTrue
}
$archiveParameters = @{
@@ -480,7 +480,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -492,19 +492,19 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should match the file contents of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeTrue
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -517,11 +517,11 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFilePath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
$archiveParameters = @{
@@ -532,7 +532,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -544,15 +544,15 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should not match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -582,7 +582,7 @@ Describe 'Archive End to End Tests' {
$otherItems[$otherFilePath] = $otherFileContent
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
foreach ($otherItemPath in $otherItems.Keys)
@@ -594,13 +594,13 @@ Describe 'Archive End to End Tests' {
if ($otherItemIsDirectory)
{
It "Other item under destination $otherItemName should exist as a directory before configuration" {
Test-Path -Path $otherItemPath -PathType 'Container' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Container' | Should -BeTrue
}
}
else
{
It "Other item under destination $otherItemName should exist as a file before configuration" {
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -BeTrue
}
It "Other file under destination $otherItemName should have the expected content before configuration" {
@@ -610,7 +610,7 @@ Describe 'Archive End to End Tests' {
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
$archiveParameters = @{
@@ -621,7 +621,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -633,7 +633,7 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
foreach ($otherItemPath in $otherItems.Keys)
@@ -645,13 +645,13 @@ Describe 'Archive End to End Tests' {
if ($otherItemIsDirectory)
{
It "Other item under destination $otherItemName should exist as a directory before configuration" {
Test-Path -Path $otherItemPath -PathType 'Container' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Container' | Should -BeTrue
}
}
else
{
It "Other item under destination $otherItemName should exist as a file before configuration" {
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -Be $true
Test-Path -Path $otherItemPath -PathType 'Leaf' | Should -BeTrue
}
It "Other file under destination $otherItemName should have the expected content before configuration" {
@@ -661,11 +661,11 @@ Describe 'Archive End to End Tests' {
}
It 'File structure of destination should not match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -676,11 +676,11 @@ Describe 'Archive End to End Tests' {
$null = New-Item -Path $destination -ItemType 'Directory'
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should not match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeFalse
}
$archiveParameters = @{
@@ -691,7 +691,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -703,15 +703,15 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should not match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -721,7 +721,7 @@ Describe 'Archive End to End Tests' {
$destination = Join-Path -Path $TestDrive -ChildPath 'NonexistentDestinationForRemove'
It 'Destination should not exist before configuration' {
Test-Path -Path $destination | Should -Be $false
Test-Path -Path $destination | Should -BeFalse
}
$archiveParameters = @{
@@ -732,7 +732,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -744,11 +744,11 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should not exist after configuration' {
Test-Path -Path $destination | Should -Be $false
Test-Path -Path $destination | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -761,15 +761,15 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFileWithDifferentFileContentPath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should not match the file contents of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeFalse
}
$archiveParameters = @{
@@ -783,7 +783,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -795,19 +795,19 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeTrue
}
It 'File contents of destination should not match the file contents of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
@@ -820,11 +820,11 @@ Describe 'Archive End to End Tests' {
$null = Expand-Archive -Path $script:testArchiveFilePath -DestinationPath $destination -Force
It 'Destination should exist before configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure and contents of destination should match the file contents of the archive before configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination -CheckContents | Should -BeTrue
}
$archiveParameters = @{
@@ -838,7 +838,7 @@ Describe 'Archive End to End Tests' {
}
It 'Should return false from Test-TargetResource with the same parameters before configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $false
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing an exception' {
@@ -850,15 +850,15 @@ Describe 'Archive End to End Tests' {
}
It 'Destination should exist after configuration' {
Test-Path -Path $destination | Should -Be $true
Test-Path -Path $destination | Should -BeTrue
}
It 'File structure of destination should not match the file structure of the archive after configuration' {
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -Be $false
Test-FileStructuresMatch -SourcePath $script:testArchiveFilePathWithoutExtension -DestinationPath $destination | Should -BeFalse
}
It 'Should return false from Test-TargetResource with the same parameters after configuration' {
MSFT_Archive\Test-TargetResource @archiveParameters | Should -Be $true
MSFT_Archive\Test-TargetResource @archiveParameters | Should -BeTrue
}
}
}
@@ -46,15 +46,15 @@ Describe 'Archive Integration Tests' {
$destinationDirectoryPath = Join-Path -Path $TestDrive -ChildPath $destinationDirectoryName
It 'File structure and contents of the destination should not match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Set-TargetResource should not throw' {
@@ -62,15 +62,15 @@ Describe 'Archive Integration Tests' {
}
It 'File structure and contents of the destination should match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
}
@@ -93,15 +93,15 @@ Describe 'Archive Integration Tests' {
$null = Expand-Archive -Path $zipFilePath -DestinationPath $destinationDirectoryPath -Force
It 'File structure and contents of the destination should match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Set-TargetResource should not throw' {
@@ -109,15 +109,15 @@ Describe 'Archive Integration Tests' {
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
}
@@ -164,15 +164,15 @@ Describe 'Archive Integration Tests' {
$destinationDirectoryPath = Join-Path -Path $TestDrive -ChildPath $destinationDirectoryName
It 'File structure and contents of the destination should not match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Set-TargetResource should not throw' {
@@ -180,15 +180,15 @@ Describe 'Archive Integration Tests' {
}
It 'File structure and contents of the destination should match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
}
@@ -237,15 +237,15 @@ Describe 'Archive Integration Tests' {
$null = Expand-Archive -Path $zipFilePath -DestinationPath $destinationDirectoryPath -Force
It 'File structure and contents of the destination should match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Set-TargetResource should not throw' {
@@ -253,15 +253,15 @@ Describe 'Archive Integration Tests' {
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
}
@@ -295,23 +295,23 @@ Describe 'Archive Integration Tests' {
$destinationDirectoryPath = Join-Path -Path $TestDrive -ChildPath $destinationDirectoryName
It 'File structure and contents of the destination should not match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath1 -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath1 -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false for specified archive before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true for specified archive before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return false for other archive with same timestamp with before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true for other archive with same timestamp before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Set-TargetResource should not throw' {
@@ -319,23 +319,23 @@ Describe 'Archive Integration Tests' {
}
It 'File structure and contents of the destination should match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath1 -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath1 -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return true for specified archive after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false for specified archive after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath1 -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false for other archive with same timestamp with before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true for other archive with same timestamp before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath2 -Destination $destinationDirectoryPath | Should -BeTrue
}
}
@@ -371,19 +371,19 @@ Describe 'Archive Integration Tests' {
$null = Set-Content -Path $newFilePath -Value 'Fake text'
It 'File structure and contents of the destination should match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Present should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Extra file should be present before Set-TargetResource' {
Test-Path -Path $newFilePath | Should -Be $true
Test-Path -Path $newFilePath | Should -BeTrue
}
It 'Set-TargetResource should not throw' {
@@ -391,19 +391,19 @@ Describe 'Archive Integration Tests' {
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Present should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath | Should -BeTrue
}
It 'Extra file should be present after Set-TargetResource' {
Test-Path -Path $newFilePath | Should -Be $true
Test-Path -Path $newFilePath | Should -BeTrue
}
}
@@ -454,17 +454,17 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return true before file edit' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false before file edit' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
$fileToEditPath = Join-Path -Path $destinationDirectoryPath -ChildPath $fileToEditName
It 'File to edit should exist at the destination before Set-TargetResource' {
Test-Path -Path $fileToEditPath | Should -Be $true
Test-Path -Path $fileToEditPath | Should -BeTrue
}
$fileBeforeEdit = Get-Item -Path $fileToEditPath
@@ -489,15 +489,15 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Set-TargetResource should not throw' {
@@ -507,7 +507,7 @@ Describe 'Archive Integration Tests' {
$fileAfterSetTargetResource = Get-Item -Path $fileToEditPath
It 'Edited file should exist at the destination after Set-TargetResource' {
Test-Path -Path $fileToEditPath | Should -Be $true
Test-Path -Path $fileToEditPath | Should -BeTrue
}
It 'Edited file at the destination should have the same content as the same file in the archive after Set-TargetResource' {
@@ -523,15 +523,15 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
It 'File structure and contents of the destination should match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $true
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeTrue
}
}
@@ -566,17 +566,17 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return true before file edit' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false before file edit' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
$fileToEditPath = Join-Path -Path $destinationDirectoryPath -ChildPath $fileToEditName
It 'File to edit should exist at the destination before Set-TargetResource' {
Test-Path -Path $fileToEditPath | Should -Be $true
Test-Path -Path $fileToEditPath | Should -BeTrue
}
$fileBeforeEdit = Get-Item -Path $fileToEditPath
@@ -601,15 +601,15 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
{ Set-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue } | Should -Throw
@@ -646,17 +646,17 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return true before file edit' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'Test-TargetResource with Ensure as Absent should return false before file edit' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
$fileToEditPath = Join-Path -Path $destinationDirectoryPath -ChildPath $fileToEditName
It 'File to edit should exist at the destination before Set-TargetResource' {
Test-Path -Path $fileToEditPath | Should -Be $true
Test-Path -Path $fileToEditPath | Should -BeTrue
}
$fileBeforeEdit = Get-Item -Path $fileToEditPath
@@ -681,15 +681,15 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return false before Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true before Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive before Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
It 'Set-TargetResource should not throw' {
@@ -697,7 +697,7 @@ Describe 'Archive Integration Tests' {
}
It 'Edited file should exist at the destination after Set-TargetResource' {
Test-Path -Path $fileToEditPath | Should -Be $true
Test-Path -Path $fileToEditPath | Should -BeTrue
}
It 'Edited file at the destination should have the edited content' {
@@ -713,15 +713,15 @@ Describe 'Archive Integration Tests' {
}
It 'Test-TargetResource with Ensure as Present should return false after Set-TargetResource' {
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $false
Test-TargetResource -Ensure 'Present' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeFalse
}
It 'Test-TargetResource with Ensure as Absent should return true after Set-TargetResource' {
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -Be $true
Test-TargetResource -Ensure 'Absent' -Path $zipFilePath -Destination $destinationDirectoryPath -Validate $true -Checksum $possibleChecksumValue | Should -BeTrue
}
It 'File structure and contents of the destination should not match the file structure and contents of the archive after Set-TargetResource' {
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -Be $false
Test-FileStructuresMatch -SourcePath $zipFileSourcePath -DestinationPath $destinationDirectoryPath -CheckContents | Should -BeFalse
}
}
}
@@ -193,7 +193,7 @@ try
Set-TargetResource -Name $envVar -Value $val
# Test the created environmnet variable
Test-TargetResource -Name $envVar | Should -Be $true
Test-TargetResource -Name $envVar | Should -BeTrue
# Remove the created test variable
Set-TargetResource -Name $envVar -Ensure Absent
@@ -205,7 +205,7 @@ try
Set-TargetResource -Name $envVar -Value $val
# Verify the environmnet variable exists
Test-TargetResource -Name $envVar -Value $val | Should -Be $true
Test-TargetResource -Name $envVar -Value $val | Should -BeTrue
# Remove the created test variable
Set-TargetResource -Name $envVar -Ensure Absent
@@ -216,7 +216,7 @@ try
Set-TargetResource -Name $envVar -Ensure Absent
# Verify the environmnet variable exists
Test-TargetResource -Name $envVar -Ensure Absent | Should -Be $true
Test-TargetResource -Name $envVar -Ensure Absent | Should -BeTrue
# Remove the created test variable
Set-TargetResource -Name $envVar -Ensure Absent
@@ -230,7 +230,7 @@ try
$subpath = 'B'
# Test a sub-path exists in environment variable
Test-TargetResource -Name $envVar -Value $subpath -Path $true | Should -Be $true
Test-TargetResource -Name $envVar -Value $subpath -Path $true | Should -BeTrue
# Remove the created test variable
Set-TargetResource -Name $envVar -Ensure Absent
@@ -243,7 +243,7 @@ try
$subpath = 'B;a;c'
Test-TargetResource -Name $envVar -Value $subpath -Path $true | Should -Be $true
Test-TargetResource -Name $envVar -Value $subpath -Path $true | Should -BeTrue
# Remove the created test variable
Set-TargetResource -Name $envVar -Ensure Absent
@@ -256,7 +256,7 @@ try
$subpath = 'D;E'
Test-TargetResource -Name $envVar -Value $subpath -Path $true -Ensure Absent | Should -Be $true
Test-TargetResource -Name $envVar -Value $subpath -Path $true -Ensure Absent | Should -BeTrue
# Remove the created test variable
Set-TargetResource -Name $envVar -Ensure Absent
@@ -76,7 +76,7 @@ try
GroupName = $testGroupName
}
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
try
{
@@ -86,7 +86,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName -Members @() | Should -Be $true
Test-GroupExists -GroupName $testGroupName -Members @() | Should -BeTrue
}
finally
{
@@ -106,7 +106,7 @@ try
GroupName = $testGroupName
}
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
{
. $script:confgurationNoMembersFilePath -ConfigurationName $configurationName
@@ -114,7 +114,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
}
It 'Should add a member to the built-in Users group with MembersToInclude' {
@@ -127,7 +127,7 @@ try
MembersToInclude = $testUsername1
}
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
{
. $script:confgurationWithMembersToIncludeExcludeFilePath -ConfigurationName $configurationName
@@ -135,7 +135,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName -MembersToInclude $testUsername1 | Should -Be $true
Test-GroupExists -GroupName $testGroupName -MembersToInclude $testUsername1 | Should -BeTrue
}
It 'Should create a group with two test users using Members' {
@@ -150,7 +150,7 @@ try
Members = $groupMembers
}
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
try
{
@@ -160,7 +160,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName -Members $groupMembers | Should -Be $true
Test-GroupExists -GroupName $testGroupName -Members $groupMembers | Should -BeTrue
}
finally
{
@@ -183,11 +183,11 @@ try
MembersToInclude = $groupMembers
}
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
New-Group -GroupName $testGroupName
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
try
{
@@ -197,7 +197,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName -MembersToInclude $groupMembers | Should -Be $true
Test-GroupExists -GroupName $testGroupName -MembersToInclude $groupMembers | Should -BeTrue
}
finally
{
@@ -220,11 +220,11 @@ try
MembersToExclude = $groupMembersToExclude
}
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
New-Group -GroupName $testGroupName -Members $groupMembersToExclude
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
try
{
@@ -234,7 +234,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName -MembersToExclude $groupMembersToExclude | Should -Be $true
Test-GroupExists -GroupName $testGroupName -MembersToExclude $groupMembersToExclude | Should -BeTrue
}
finally
{
@@ -254,11 +254,11 @@ try
GroupName = $testGroupName
}
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
New-Group -GroupName $testGroupName
Test-GroupExists -GroupName $testGroupName | Should -Be $true
Test-GroupExists -GroupName $testGroupName | Should -BeTrue
try
{
@@ -268,7 +268,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Not -Throw
Test-GroupExists -GroupName $testGroupName | Should -Be $false
Test-GroupExists -GroupName $testGroupName | Should -BeFalse
}
finally
{
@@ -89,7 +89,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return True from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $true
$testTargetResourceInitialResult | Should -BeTrue
if ($testTargetResourceInitialResult -ne $true)
{
@@ -103,7 +103,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should not exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -115,11 +115,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should not exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
}
@@ -134,7 +134,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -148,7 +148,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should not exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -160,11 +160,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
}
@@ -179,7 +179,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return True from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $true
$testTargetResourceInitialResult | Should -BeTrue
if ($testTargetResourceInitialResult -ne $true)
{
@@ -193,7 +193,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
It 'Should compile and run configuration' {
@@ -205,11 +205,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
}
@@ -224,7 +224,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -238,7 +238,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
It 'Should compile and run configuration' {
@@ -250,11 +250,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should not exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
}
@@ -277,7 +277,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -291,7 +291,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should not exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -303,15 +303,15 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Should have created the log file' {
Test-Path -Path $logPath | Should -Be $true
Test-Path -Path $logPath | Should -BeTrue
}
It 'Package should exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
}
@@ -334,7 +334,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -348,7 +348,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
It 'Should compile and run configuration' {
@@ -360,15 +360,15 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Should have created the log file' {
Test-Path -Path $logPath | Should -Be $true
Test-Path -Path $logPath | Should -BeTrue
}
It 'Package should not exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
}
@@ -390,7 +390,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -404,7 +404,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should not exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
try
@@ -436,11 +436,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return True from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
}
@@ -462,7 +462,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -476,7 +476,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
try
@@ -508,11 +508,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should not exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
}
@@ -534,7 +534,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -548,7 +548,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should not exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
try
@@ -580,11 +580,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
}
@@ -606,7 +606,7 @@ Describe 'MsiPackage End to End Tests' {
It 'Should return False from Test-TargetResource with the same parameters before configuration' {
$testTargetResourceInitialResult = MSFT_MsiPackage\Test-TargetResource @msiPackageParameters
$testTargetResourceInitialResult | Should -Be $false
$testTargetResourceInitialResult | Should -BeFalse
if ($testTargetResourceInitialResult -ne $false)
{
@@ -620,7 +620,7 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Package should exist on the machine before configuration is run' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
}
try
@@ -652,11 +652,11 @@ Describe 'MsiPackage End to End Tests' {
}
It 'Should return true from Test-TargetResource with the same parameters after configuration' {
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -Be $true
MSFT_MsiPackage\Test-TargetResource @msiPackageParameters | Should -BeTrue
}
It 'Package should not exist on the machine' {
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
}
}
@@ -117,34 +117,34 @@ try
-Path $script:msiLocation `
-ProductId $script:packageId
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
$testTargetResourceResult = Test-TargetResource `
-Ensure 'Absent' `
-Path $script:msiLocation `
-ProductId $script:packageId
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return correct value when package is present' {
Set-TargetResource -Ensure 'Present' -Path $script:msiLocation -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
$testTargetResourceResult = Test-TargetResource `
-Ensure 'Present' `
-Path $script:msiLocation `
-ProductId $script:packageId `
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
$testTargetResourceResult = Test-TargetResource `
-Ensure 'Absent' `
-Path $script:msiLocation `
-ProductId $script:packageId `
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -152,7 +152,7 @@ try
It 'Should correctly install and remove a .msi package' {
Set-TargetResource -Ensure 'Present' -Path $script:msiLocation -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
$getTargetResourceResult = Get-TargetResource -Path $script:msiLocation -ProductId $script:packageId
@@ -164,7 +164,7 @@ try
Set-TargetResource -Ensure 'Absent' -Path $script:msiLocation -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
It 'Should throw with incorrect product id' {
@@ -200,10 +200,10 @@ try
{ Set-TargetResource -Ensure 'Present' -Path $baseUrl -ProductId $script:packageId } | Should -Throw
Set-TargetResource -Ensure 'Present' -Path $msiUrl -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
Set-TargetResource -Ensure 'Absent' -Path $msiUrl -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
catch
{
@@ -248,10 +248,10 @@ try
{ Set-TargetResource -Ensure 'Present' -Path $baseUrl -ProductId $script:packageId } | Should -Throw
Set-TargetResource -Ensure 'Present' -Path $msiUrl -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $true
Test-PackageInstalledById -ProductId $script:packageId | Should -BeTrue
Set-TargetResource -Ensure 'Absent' -Path $msiUrl -ProductId $script:packageId
Test-PackageInstalledById -ProductId $script:packageId | Should -Be $false
Test-PackageInstalledById -ProductId $script:packageId | Should -BeFalse
}
catch
{
@@ -279,7 +279,7 @@ try
Set-TargetResource -Ensure 'Present' -Path $script:msiLocation -LogPath $logPath -ProductId $script:packageId
Test-Path -Path $logPath | Should -Be $true
Test-Path -Path $logPath | Should -BeTrue
Get-Content -Path $logPath | Should -Not -Be $null
}
@@ -72,7 +72,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -108,7 +108,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -146,7 +146,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -206,7 +206,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
}
@@ -247,7 +247,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -286,7 +286,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -318,7 +318,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -352,7 +352,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
@@ -384,7 +384,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -Be $true
MSFT_RegistryResource\Test-TargetResource @registryParameters | Should -BeTrue
}
}
}
@@ -116,7 +116,7 @@ try
# Verify that the registry key has been created
$registryKeyExists = Test-RegistryKeyExists -KeyPath $script:registryKeyPath
$registryKeyExists | Should -Be $true
$registryKeyExists | Should -BeTrue
}
It 'Should create a new registry key tree' {
@@ -126,7 +126,7 @@ try
# Verify that the registry key has been created
$registryKeyExists = Test-RegistryKeyExists -KeyPath $registryKeyTreePath
$registryKeyExists | Should -Be $true
$registryKeyExists | Should -BeTrue
}
It 'Should remove a registry key' {
@@ -135,14 +135,14 @@ try
# Verify that the registry key exists before removal
$registryKeyExists = Test-RegistryKeyExists -KeyPath $script:registryKeyPath
$registryKeyExists | Should -Be $true
$registryKeyExists | Should -BeTrue
# Now remove the TestKey
Set-TargetResource -Key $script:registryKeyPath -ValueName '' -Ensure 'Absent'
# Verify that the registry key has been removed
$registryKeyExists = Test-RegistryKeyExists -KeyPath $script:registryKeyPath
$registryKeyExists | Should -Be $false
$registryKeyExists | Should -BeFalse
}
It 'Should remove a registry key tree' {
@@ -153,14 +153,14 @@ try
# Verify that the registry key tree exists before removal
$registryKeyExists = Test-RegistryKeyExists -KeyPath $registryKeyTreePath
$registryKeyExists | Should -Be $true
$registryKeyExists | Should -BeTrue
# Remove the test registry key tree
Set-TargetResource -Key $registryKeyTreePath -ValueName '' -Ensure 'Absent'
# Verify that the registry key tree has been removed
$registryKeyExists = Test-RegistryKeyExists -KeyPath $registryKeyTreePath
$registryKeyExists | Should -Be $false
$registryKeyExists | Should -BeFalse
}
It 'Should create a new string registry key value' {
@@ -173,7 +173,7 @@ try
# Verify that the registry key value has been created with the correct data and type
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
}
It 'Should create a new binary registry key value' {
@@ -186,7 +186,7 @@ try
# Verify that the registry key value has been created with the correct data and type
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
}
It 'Should set the default value of a registry key' {
@@ -198,7 +198,7 @@ try
# Verify that the registry key value has been created with the correct data and type
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName '(default)' -ValueData $valueData -ValueType 'String'
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
}
It 'Should remove a registry key value' {
@@ -211,14 +211,14 @@ try
# Verify that the registry key value exists before removal
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName $valueName
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
# Remove the registry value
Set-TargetResource -Key $script:registryKeyPath -ValueName $valueName -Ensure 'Absent'
# Verify that the registry key value has been removed
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName $valueName
$registryValueExists | Should -Be $false
$registryValueExists | Should -BeFalse
}
It 'Should remove the default value for a registry key' {
@@ -231,14 +231,14 @@ try
# Verify that the registry key value exists before removal
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName '(default)'
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
# Remove the registry value
Set-TargetResource -Key $script:registryKeyPath -ValueName $valueName -Ensure 'Absent'
# Verify that the registry key value has been removed
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName '(default)'
$registryValueExists | Should -Be $false
$registryValueExists | Should -BeFalse
}
It 'Should create a new key and value with path containing forward slashes' {
@@ -251,46 +251,46 @@ try
# Verify that the registry key value has been created with the correct data and type
$registryValueExists = Test-RegistryValueExists -KeyPath $registryKeyPathWithForwardSlashes -ValueName $valueName -ValueData $valueData
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
}
# Test-TargetResource
It 'Should return true for an existing registry key' {
$registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName ''
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false for a registry key that does not exist' {
$registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environmentally'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName ''
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return true for an existing registry value' {
$registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$valueName = 'path'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName $valueName
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false for a registry value that does not exist' {
$registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$valueName = 'NonExisting'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName $valueName
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return true when Ensure is Absent and registry key does not exist' {
$registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environmentally'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName '' -Ensure 'Absent'
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false when Ensure is Absent and registry key exists' {
$registryKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName '' -Ensure 'Absent'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when Ensure is Absent and registry value exists with invalid data' {
@@ -299,7 +299,7 @@ try
$valueData = 'FakePath'
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName $valueName -ValueData $valueData -Ensure 'Absent'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return true for a multi-string registry value' {
@@ -311,7 +311,7 @@ try
New-RegistryValue -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType
$testTargetResourceResult = Test-TargetResource -Key $registryKeyPath -ValueName $valueName -ValueData $valueData
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return true for a binary registry value' {
@@ -323,7 +323,7 @@ try
New-RegistryValue -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType
$testTargetResourceResult = Test-TargetResource -Key $script:registryKeyPath -ValueName $valueName -ValueData $valueData
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return true for an empty binary registry value' {
@@ -336,10 +336,10 @@ try
# Verify that the registry key value has been created with the correct data and type
$registryValueExists = Test-RegistryValueExists -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType
$registryValueExists | Should -Be $true
$registryValueExists | Should -BeTrue
$testTargetResourceResult = Test-TargetResource -Key $script:registryKeyPath -ValueName $valueName -ValueData $valueData
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return true for binary registry value with zeroes' {
@@ -351,7 +351,7 @@ try
New-RegistryValue -KeyPath $script:registryKeyPath -ValueName $valueName -ValueData $valueData -ValueType $valueType
$testTargetResourceResult = Test-TargetResource -Key $script:registryKeyPath -ValueName $valueName -ValueData $valueData
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
}
@@ -62,7 +62,7 @@ Describe 'Script Integration Tests' {
}
It 'Should have removed test file before the configuration' {
Test-Path -Path $resourceParameters.FilePath | Should Be $false
Test-Path -Path $resourceParameters.FilePath | Should -BeFalse
}
It 'Should compile and apply the MOF without throwing' {
@@ -74,7 +74,7 @@ Describe 'Script Integration Tests' {
}
It 'Should have created the test file' {
Test-Path -Path $resourceParameters.FilePath | Should Be $true
Test-Path -Path $resourceParameters.FilePath | Should -BeTrue
}
It 'Should have set file content correctly' {
@@ -100,7 +100,7 @@ Describe 'Script Integration Tests' {
}
It 'Should have removed test file before config runs' {
Test-Path -Path $resourceParameters.FilePath | Should -Be $false
Test-Path -Path $resourceParameters.FilePath | Should -BeFalse
}
$configData = @{
@@ -122,7 +122,7 @@ Describe 'Script Integration Tests' {
}
It 'Should have created the test file' {
Test-Path -Path $resourceParameters.FilePath | Should -Be $true
Test-Path -Path $resourceParameters.FilePath | Should -BeTrue
}
It 'Should have set file content correctly' {
@@ -170,11 +170,11 @@ try
}
It 'Should have created a new service with the default desktop interaction setting as False' {
$serviceCimInstance.DesktopInteract | Should -Be $false
$serviceCimInstance.DesktopInteract | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -Be $true
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -BeTrue
}
}
@@ -233,11 +233,11 @@ try
}
It 'Should not have changed the service desktop interaction setting from False' {
$serviceCimInstance.DesktopInteract | Should -Be $false
$serviceCimInstance.DesktopInteract | Should -BeFalse
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -Be $true
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -BeTrue
}
}
@@ -280,7 +280,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -Be $true
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -BeTrue
}
}
@@ -333,7 +333,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -Be $true
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -BeTrue
}
}
@@ -371,7 +371,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -Be $true
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -BeTrue
}
}
@@ -402,7 +402,7 @@ try
}
It 'Should return true from Test-TargetResource with the same parameters' {
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -Be $true
MSFT_ServiceResource\Test-TargetResource @resourceParameters | Should -BeTrue
}
}
}
@@ -81,8 +81,8 @@ try
$currentConfig.UserName | Should Be $script:testUserName
$currentConfig.Ensure | Should -Be 'Present'
$currentConfig.Description | Should Be $script:testDescription
$currentConfig.PasswordNeverExpires | Should Be $false
$currentConfig.Disabled | Should -Be $false
$currentConfig.PasswordNeverExpires | Should -BeFalse
$currentConfig.Disabled | Should -BeFalse
$currentConfig.PasswordChangeRequired | Should -Be $null
}
}
@@ -128,8 +128,8 @@ try
$currentConfig.UserName | Should Be $script:testUserName
$currentConfig.Ensure | Should Be 'Present'
$currentConfig.Description | Should Be $newTestDescription
$currentConfig.PasswordNeverExpires | Should Be $false
$currentConfig.Disabled | Should Be $false
$currentConfig.PasswordNeverExpires | Should -BeFalse
$currentConfig.Disabled | Should -BeFalse
$currentConfig.PasswordChangeRequired | Should Be $null
}
}
@@ -178,8 +178,8 @@ try
$currentConfig.Ensure | Should -Be 'Present'
$currentConfig.Description | Should Be $script:testDescription
$currentConfig.FullName | Should Be $newFullName
$currentConfig.PasswordNeverExpires | Should Be $true
$currentConfig.Disabled | Should -Be $false
$currentConfig.PasswordNeverExpires | Should -BeTrue
$currentConfig.Disabled | Should -BeFalse
$currentConfig.PasswordChangeRequired | Should -Be $null
}
}
@@ -113,13 +113,13 @@ try
It 'Should return the correct configuration' {
$currentConfig = Get-DscConfiguration -ErrorAction 'Stop'
$currentConfig.Name | Should -Be $script:testFeatureName
$currentConfig.IncludeAllSubFeature | Should -Be $false
$currentConfig.IncludeAllSubFeature | Should -BeFalse
$currentConfig.Ensure | Should -Be 'Present'
}
It 'Should be Installed' {
$feature = Get-WindowsFeature -Name $script:testFeatureName
$feature.Installed | Should -Be $true
$feature.Installed | Should -BeTrue
}
}
finally
@@ -162,13 +162,13 @@ try
It 'Should return the correct configuration' {
$currentConfig = Get-DscConfiguration -ErrorAction 'Stop'
$currentConfig.Name | Should -Be $script:testFeatureName
$currentConfig.IncludeAllSubFeature | Should -Be $false
$currentConfig.IncludeAllSubFeature | Should -BeFalse
$currentConfig.Ensure | Should -Be 'Absent'
}
It 'Should not be installed' {
$feature = Get-WindowsFeature -Name $script:testFeatureName
$feature.Installed | Should -Be $false
$feature.Installed | Should -BeFalse
}
}
finally
@@ -225,18 +225,18 @@ try
It 'Should return the correct configuration' -Skip:$script:skipLongTests {
$currentConfig = Get-DscConfiguration -ErrorAction 'Stop'
$currentConfig.Name | Should Be $script:testFeatureWithSubFeaturesName
$currentConfig.IncludeAllSubFeature | Should Be $true
$currentConfig.IncludeAllSubFeature | Should -BeTrue
$currentConfig.Ensure | Should Be 'Present'
}
It 'Should be Installed (includes check for subFeatures)' -Skip:$script:skipLongTests {
$feature = Get-WindowsFeature -Name $script:testFeatureWithSubFeaturesName
$feature.Installed | Should Be $true
$feature.Installed | Should -BeTrue
foreach ($subFeatureName in $feature.SubFeatures)
{
$subFeature = Get-WindowsFeature -Name $subFeatureName
$subFeature.Installed | Should Be $true
$subFeature.Installed | Should -BeTrue
}
}
}
@@ -266,18 +266,18 @@ try
It 'Should return the correct configuration' -Skip:$script:skipLongTests {
$currentConfig = Get-DscConfiguration -ErrorAction 'Stop'
$currentConfig.Name | Should Be $script:testFeatureWithSubFeaturesName
$currentConfig.IncludeAllSubFeature | Should Be $false
$currentConfig.IncludeAllSubFeature | Should -BeFalse
$currentConfig.Ensure | Should Be 'Absent'
}
It 'Should not be installed (includes check for subFeatures)' -Skip:$script:skipLongTests {
$feature = Get-WindowsFeature -Name $script:testFeatureWithSubFeaturesName
$feature.Installed | Should Be $false
$feature.Installed | Should -BeFalse
foreach ($subFeatureName in $feature.SubFeatures)
{
$subFeature = Get-WindowsFeature -Name $subFeatureName
$subFeature.Installed | Should Be $false
$subFeature.Installed | Should -BeFalse
}
}
}
@@ -54,7 +54,7 @@ try
$windowsOptionalFeature = Dism\Get-WindowsOptionalFeature -FeatureName $resourceParameters.Name -Online
$windowsOptionalFeature | Should -Not -Be $null
$windowsOptionalFeature.State -in $script:enabledStates | Should -Be $true
$windowsOptionalFeature.State -in $script:enabledStates | Should -BeTrue
}
finally
{
@@ -103,7 +103,7 @@ try
$windowsOptionalFeature = Dism\Get-WindowsOptionalFeature -FeatureName $resourceParameters.Name -Online
$windowsOptionalFeature | Should -Not -Be $null
$windowsOptionalFeature.State -in $script:disabledStates | Should -Be $true
$windowsOptionalFeature.State -in $script:disabledStates | Should -BeTrue
}
finally
{
@@ -143,7 +143,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Throw "Feature name $($resourceParameters.Name) is unknown."
Test-Path -Path $resourceParameters.LogPath | Should -Be $true
Test-Path -Path $resourceParameters.LogPath | Should -BeTrue
Dism\Get-WindowsOptionalFeature -FeatureName $resourceParameters.Name -Online | Should -Be $null
}
@@ -90,7 +90,7 @@ try
$windowsPackage = Dism\Get-WindowsPackage -PackageName $resourceParameters.Name -Online
$windowsPackage | Should -Not -Be $null
$windowsPackage.PackageState -in $script:installedStates | Should -Be $true
$windowsPackage.PackageState -in $script:installedStates | Should -BeTrue
}
It 'Should uninstall a Windows package through a cab file' -Skip:$script:cabPackageNotProvided {
@@ -133,7 +133,7 @@ try
Start-DscConfiguration -Path $TestDrive -ErrorAction 'Stop' -Wait -Force
} | Should -Throw
Test-Path -Path $resourceParameters.LogPath | Should -Be $true
Test-Path -Path $resourceParameters.LogPath | Should -BeTrue
{ Dism\Get-WindowsPackage -PackageName $resourceParameters.Name -Online } | Should -Throw
}
@@ -55,7 +55,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -86,7 +86,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
}
@@ -110,7 +110,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -142,7 +142,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
}
@@ -171,7 +171,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
It 'Should compile and run configuration' {
@@ -203,7 +203,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
}
@@ -232,7 +232,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
# Remove the created log file so that we can check that the configuration did not re-create it
@@ -266,7 +266,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
}
@@ -290,7 +290,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -327,7 +327,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
}
@@ -361,7 +361,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
# Remove the created log file so that we can check that the configuration did not re-create it
@@ -395,7 +395,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
}
}
@@ -437,7 +437,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -468,7 +468,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
}
@@ -493,7 +493,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -525,7 +525,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
}
@@ -555,7 +555,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
It 'Should compile and run configuration' {
@@ -587,7 +587,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
}
@@ -617,7 +617,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
# Remove the created log file so that we can check that the configuration did not re-create it
@@ -651,7 +651,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
}
@@ -676,7 +676,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
It 'Should compile and run configuration' {
@@ -713,7 +713,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
}
@@ -748,7 +748,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should be able to find the log file before configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $true
$pathResult | Should -BeTrue
}
# Remove the created log file so that we can check that the configuration did not re-create it
@@ -782,7 +782,7 @@ Describe 'WindowsProcess Integration Tests' {
It 'Should not be able to find the log file after configuration' {
$pathResult = Test-Path -Path $logFilePath
$pathResult | Should Be $false
$pathResult | Should -BeFalse
}
}
}
@@ -81,7 +81,7 @@ try
}
It "Should have uninstalled Windows feature $windowsFeatureName before the configuration" {
$windowsFeature.Installed | Should -Be $false
$windowsFeature.Installed | Should -BeFalse
}
}
@@ -114,12 +114,12 @@ try
}
It "Should have installed Windows feature $windowsFeatureName after the configuration" {
$windowsFeature.Installed | Should -Be $true
$windowsFeature.Installed | Should -BeTrue
}
}
It 'Should have created the log file' {
Test-Path -Path $windowsFeatureSetParameters.LogPath | Should -Be $true
Test-Path -Path $windowsFeatureSetParameters.LogPath | Should -BeTrue
}
It 'Should have created content in the log file' {
@@ -160,7 +160,7 @@ try
}
It "Should have installed Windows feature $windowsFeatureName before the configuration" {
$windowsFeature.Installed | Should -Be $true
$windowsFeature.Installed | Should -BeTrue
}
}
@@ -193,12 +193,12 @@ try
}
It "Should have uninstalled Windows feature $windowsFeatureName after the configuration" {
$windowsFeature.Installed | Should -Be $false
$windowsFeature.Installed | Should -BeFalse
}
}
It 'Should have created the log file' {
Test-Path -Path $windowsFeatureSetParameters.LogPath | Should -Be $true
Test-Path -Path $windowsFeatureSetParameters.LogPath | Should -BeTrue
}
It 'Should have created content in the log file' {
@@ -87,7 +87,7 @@ try
}
It "Should have disabled Windows optional feature $windowsOptionalFeatureName before the configuration" {
$windowsOptionalFeature.State -in $script:disabledStates | Should -Be $true
$windowsOptionalFeature.State -in $script:disabledStates | Should -BeTrue
}
}
@@ -117,12 +117,12 @@ try
}
It "Should have enabled Windows optional feature $windowsOptionalFeatureName after the configuration" {
$windowsOptionalFeature.State -in $script:enabledStates | Should -Be $true
$windowsOptionalFeature.State -in $script:enabledStates | Should -BeTrue
}
}
It 'Should have created the log file' {
Test-Path -Path $wofSetParameters.LogPath | Should -Be $true
Test-Path -Path $wofSetParameters.LogPath | Should -BeTrue
}
It 'Should have created content in the log file' {
@@ -163,7 +163,7 @@ try
}
It "Should have enabled Windows optional feature $windowsOptionalFeatureName before the configuration" {
$windowsOptionalFeature.State -in $script:enabledStates | Should -Be $true
$windowsOptionalFeature.State -in $script:enabledStates | Should -BeTrue
}
}
@@ -193,12 +193,12 @@ try
}
It "Should have disabled Windows optional feature $windowsOptionalFeatureName after the confguration" {
$windowsOptionalFeature.State -in $script:disabledStates | Should -Be $true
$windowsOptionalFeature.State -in $script:disabledStates | Should -BeTrue
}
}
It 'Should have created the log file' {
Test-Path -Path $wofSetParameters.LogPath | Should -Be $true
Test-Path -Path $wofSetParameters.LogPath | Should -BeTrue
}
It 'Should have created content in the log file' {
+3 -3
View File
@@ -280,7 +280,7 @@ function Invoke-GetTargetResourceUnitTest
$getTargetResourceResult = Get-TargetResource @GetTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It "Should return a Hashtable with $($ExpectedReturnValue.Keys.Count) properties" {
@@ -656,13 +656,13 @@ function Test-SetTargetResourceWithWhatIf
if ($null -eq $ExpectedOutput -or $ExpectedOutput.Count -eq 0)
{
[System.String]::IsNullOrEmpty($transcriptContent) | Should -Be $true
[System.String]::IsNullOrEmpty($transcriptContent) | Should -BeTrue
}
else
{
foreach ($expectedOutputPiece in $ExpectedOutput)
{
$transcriptContent.Contains($expectedOutputPiece) | Should -Be $true
$transcriptContent.Contains($expectedOutputPiece) | Should -BeTrue
}
}
}
+5 -5
View File
@@ -32,7 +32,7 @@ Describe 'CommonResourceHelper Unit Tests' {
}
It 'Should return true' {
Test-IsNanoServer | Should -Be $true
Test-IsNanoServer | Should -BeTrue
}
}
@@ -49,7 +49,7 @@ Describe 'CommonResourceHelper Unit Tests' {
}
It 'Should return false' {
Test-IsNanoServer | Should -Be $false
Test-IsNanoServer | Should -BeFalse
}
}
@@ -65,7 +65,7 @@ Describe 'CommonResourceHelper Unit Tests' {
}
It 'Should return false' {
Test-IsNanoServer | Should -Be $false
Test-IsNanoServer | Should -BeFalse
}
}
}
@@ -89,7 +89,7 @@ Describe 'CommonResourceHelper Unit Tests' {
}
It 'Should return true' {
Test-CommandExists -Name $testCommandName | Should -Be $true
Test-CommandExists -Name $testCommandName | Should -BeTrue
}
}
@@ -109,7 +109,7 @@ Describe 'CommonResourceHelper Unit Tests' {
}
It 'Should return false' {
Test-CommandExists -Name $testCommandName | Should -Be $false
Test-CommandExists -Name $testCommandName | Should -BeFalse
}
}
}
+37 -37
View File
@@ -137,7 +137,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -211,7 +211,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -292,7 +292,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -374,7 +374,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -455,7 +455,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -537,7 +537,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -631,7 +631,7 @@ Describe 'Archive Unit Tests' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a Hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return a Hashtable with 3 properties' {
@@ -1398,7 +1398,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
@@ -1425,7 +1425,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1454,7 +1454,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1481,7 +1481,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
@@ -1512,7 +1512,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1541,7 +1541,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
}
@@ -1817,7 +1817,7 @@ Describe 'Archive Unit Tests' {
$testChecksumIsShaResult = Test-ChecksumIsSha @testChecksumIsShaParameters
It 'Should return true' {
$testChecksumIsShaResult | Should -Be $true
$testChecksumIsShaResult | Should -BeTrue
}
}
@@ -1833,7 +1833,7 @@ Describe 'Archive Unit Tests' {
$testChecksumIsShaResult = Test-ChecksumIsSha @testChecksumIsShaParameters
It 'Should return false' {
$testChecksumIsShaResult | Should -Be $false
$testChecksumIsShaResult | Should -BeFalse
}
}
@@ -1849,7 +1849,7 @@ Describe 'Archive Unit Tests' {
$testChecksumIsShaResult = Test-ChecksumIsSha @testChecksumIsShaParameters
It 'Should return false' {
$testChecksumIsShaResult | Should -Be $false
$testChecksumIsShaResult | Should -BeFalse
}
}
}
@@ -1999,7 +1999,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-FileHashMatchesArchiveEntryHash @testFileHashMatchesArchiveEntryHashParameters | Should -Be $true
Test-FileHashMatchesArchiveEntryHash @testFileHashMatchesArchiveEntryHashParameters | Should -BeTrue
}
}
@@ -2088,7 +2088,7 @@ Describe 'Archive Unit Tests' {
It 'Should return false' {
$script:timesGetFileHashCalled = 0
Test-FileHashMatchesArchiveEntryHash @testFileHashMatchesArchiveEntryHashParameters | Should -Be $false
Test-FileHashMatchesArchiveEntryHash @testFileHashMatchesArchiveEntryHashParameters | Should -BeFalse
}
}
}
@@ -2287,7 +2287,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -Be $false
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -BeFalse
}
}
@@ -2347,7 +2347,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -Be $true
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -BeTrue
}
}
@@ -2403,7 +2403,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -Be $false
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -BeFalse
}
}
@@ -2459,7 +2459,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -Be $true
Test-FileMatchesArchiveEntryByChecksum @testFileMatchesArchiveEntryByChecksumParameters | Should -BeTrue
}
}
}
@@ -2475,7 +2475,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -Be $false
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -BeFalse
}
}
@@ -2489,7 +2489,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -Be $false
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -BeFalse
}
}
@@ -2503,7 +2503,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -Be $false
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -BeFalse
}
}
@@ -2517,7 +2517,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -Be $true
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -BeTrue
}
}
@@ -2531,7 +2531,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -Be $true
Test-ArchiveEntryIsDirectory @testArchiveEntryNameIsDirectoryPathParameters | Should -BeTrue
}
}
}
@@ -2629,7 +2629,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -2715,7 +2715,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -2801,7 +2801,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -2892,7 +2892,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $true
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeTrue
}
}
@@ -2974,7 +2974,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -3060,7 +3060,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -3146,7 +3146,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -3232,7 +3232,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $true
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeTrue
}
}
@@ -3325,7 +3325,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return false' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $false
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeFalse
}
}
@@ -3420,7 +3420,7 @@ Describe 'Archive Unit Tests' {
}
It 'Should return true' {
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -Be $true
Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters | Should -BeTrue
}
}
}
+57 -57
View File
@@ -53,7 +53,7 @@ try
}
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the environment variable name' {
@@ -77,7 +77,7 @@ try
}
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the environment variable name' {
@@ -101,7 +101,7 @@ try
}
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the environment variable name' {
@@ -125,7 +125,7 @@ try
}
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the environment variable name' {
@@ -149,7 +149,7 @@ try
}
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the environment variable name' {
@@ -173,7 +173,7 @@ try
}
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the environment variable name' {
@@ -1176,7 +1176,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $script:mockEnvironmentVarName `
-Ensure 'Present' `
-Path $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1194,7 +1194,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $script:mockEnvironmentVarName `
-Ensure 'Present' `
-Path $true
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1212,7 +1212,7 @@ try
-Value $expectedValue `
-Ensure 'Present' `
-Path $false
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1230,7 +1230,7 @@ try
-Value $expectedValue `
-Ensure 'Present' `
-Path $false
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1248,7 +1248,7 @@ try
-Value $expectedValue `
-Ensure 'Present' `
-Path $true
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1267,7 +1267,7 @@ try
-Value $expectedValue `
-Ensure 'Present' `
-Path $true
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1298,7 +1298,7 @@ try
-Value $expectedValue `
-Ensure 'Present' `
-Path $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1320,7 +1320,7 @@ try
-Value $expectedValue `
-Ensure 'Present' `
-Path $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1338,7 +1338,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $script:mockEnvironmentVarName `
-Ensure 'Absent' `
-Path $true
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1356,7 +1356,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $script:mockEnvironmentVarName `
-Ensure 'Absent' `
-Path $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1374,7 +1374,7 @@ try
-Value $expectedValue `
-Ensure 'Absent' `
-Path $false
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1392,7 +1392,7 @@ try
-Value $expectedValue `
-Ensure 'Absent' `
-Path $false
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1424,7 +1424,7 @@ try
-Value $expectedValue `
-Ensure 'Absent' `
-Path $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1446,7 +1446,7 @@ try
-Value $expectedValue `
-Ensure 'Absent' `
-Path $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1464,7 +1464,7 @@ try
-Value 'nonExistentValue' `
-Ensure 'Absent' `
-Path $true
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1486,7 +1486,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1503,7 +1503,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1523,7 +1523,7 @@ try
-Ensure 'Present' `
-Path $false `
-Target @('Process')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1542,7 +1542,7 @@ try
-Ensure 'Present' `
-Path $false `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1561,7 +1561,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1580,7 +1580,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1611,7 +1611,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1629,7 +1629,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1646,7 +1646,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1663,7 +1663,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1681,7 +1681,7 @@ try
-Ensure 'Absent' `
-Path $false `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1700,7 +1700,7 @@ try
-Ensure 'Absent' `
-Path $false `
-Target @('Process')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1731,7 +1731,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1752,7 +1752,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1772,7 +1772,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Process')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1794,7 +1794,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1813,7 +1813,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1832,7 +1832,7 @@ try
-Ensure 'Present' `
-Path $false `
-Target @('Machine')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1851,7 +1851,7 @@ try
-Ensure 'Present' `
-Path $false `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1870,7 +1870,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1892,7 +1892,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1924,7 +1924,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -1947,7 +1947,7 @@ try
-Ensure 'Present' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1965,7 +1965,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -1983,7 +1983,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -2002,7 +2002,7 @@ try
-Ensure 'Absent' `
-Path $false `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -2021,7 +2021,7 @@ try
-Ensure 'Absent' `
-Path $false `
-Target @('Machine')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -2054,7 +2054,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should have called the correct mocks' {
@@ -2077,7 +2077,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -2096,7 +2096,7 @@ try
-Ensure 'Absent' `
-Path $true `
-Target @('Machine')
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should have called the correct mocks' {
@@ -2311,21 +2311,21 @@ try
$testPathInPathListWithCriteriaResult = Test-PathsInValue -ExistingPaths $existingPaths `
-QueryPaths 'path3' `
-FindCriteria 'Any'
$testPathInPathListWithCriteriaResult | Should -Be $true
$testPathInPathListWithCriteriaResult | Should -BeTrue
}
It 'Should return true when one of many paths is contained in path list' {
$testPathInPathListWithCriteriaResult = Test-PathsInValue -ExistingPaths $existingPaths `
-QueryPaths 'path0;path7;path3;path8'`
-FindCriteria 'Any'
$testPathInPathListWithCriteriaResult | Should -Be $true
$testPathInPathListWithCriteriaResult | Should -BeTrue
}
It 'Should return false when no path is contained in path list' {
$testPathInPathListWithCriteriaResult = Test-PathsInValue -ExistingPaths $existingPaths `
-QueryPaths 'path0;path7;path8;path9' `
-FindCriteria 'Any'
$testPathInPathListWithCriteriaResult | Should -Be $false
$testPathInPathListWithCriteriaResult | Should -BeFalse
}
}
@@ -2334,21 +2334,21 @@ try
$testPathInPathListWithCriteriaResult = Test-PathsInValue -ExistingPaths $existingPaths `
-QueryPaths 'path3' `
-FindCriteria 'All'
$testPathInPathListWithCriteriaResult | Should -Be $true
$testPathInPathListWithCriteriaResult | Should -BeTrue
}
It 'Should return false when path is not contained in path list' {
$testPathInPathListWithCriteriaResult = Test-PathsInValue -ExistingPaths $existingPaths `
-QueryPaths 'path4' `
-FindCriteria 'All'
$testPathInPathListWithCriteriaResult | Should -Be $false
$testPathInPathListWithCriteriaResult | Should -BeFalse
}
It 'Should return false when one of many paths is not contained in path list' {
$testPathInPathListWithCriteriaResult = Test-PathsInValue -ExistingPaths $existingPaths `
-QueryPaths 'path1;path2;path3;path4' `
-FindCriteria 'All'
$testPathInPathListWithCriteriaResult | Should -Be $false
$testPathInPathListWithCriteriaResult | Should -BeFalse
}
}
}
+45 -45
View File
@@ -311,7 +311,7 @@ Describe 'GroupResource Unit Tests' {
$LocalMachineScope
)
Test-IsLocalMachine -Scope $LocalMachineScope | Should -Be $true
Test-IsLocalMachine -Scope $LocalMachineScope | Should -BeTrue
}
$customLocalIPAddress = '123.4.5.6'
@@ -319,7 +319,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true if custom local IP address provided and Get-CimInstance contains matching IP address' {
Mock -CommandName 'Get-CimInstance' -MockWith { return @{ IPAddress = @($customLocalIPAddress, '789.1.2.3')} }
Test-IsLocalMachine -Scope $customLocalIPAddress | Should -Be $true
Test-IsLocalMachine -Scope $customLocalIPAddress | Should -BeTrue
}
}
@@ -327,13 +327,13 @@ Describe 'GroupResource Unit Tests' {
$customLocalIPAddress = '123.4.5.6'
It 'Should return false if custom local IP address provided and Get-CimInstance returns null' {
Test-IsLocalMachine -Scope $customLocalIPAddress | Should -Be $false
Test-IsLocalMachine -Scope $customLocalIPAddress | Should -BeFalse
}
It 'Should return false if custom local IP address provided and Get-CimInstance do not contain matching IP addresses' {
Mock -CommandName 'Get-CimInstance' -MockWith { return @{ IPAddress = @('789.1.2.3')} }
Test-IsLocalMachine -Scope $customLocalIPAddress | Should -Be $false
Test-IsLocalMachine -Scope $customLocalIPAddress | Should -BeFalse
}
}
}
@@ -429,7 +429,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
$getTargetResourceResult.Keys.Count | Should -Be 2
$getTargetResourceResult.GroupName | Should -Be $script:testGroupName
$getTargetResourceResult.Ensure | Should -Be 'Absent'
@@ -457,7 +457,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group -eq $script:testLocalGroup }
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
$getTargetResourceResult.Keys.Count | Should -Be 4
$getTargetResourceResult.GroupName | Should -Be $script:testGroupName
$getTargetResourceResult.Ensure | Should -Be 'Present'
@@ -478,7 +478,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group -eq $script:testLocalGroup }
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
$getTargetResourceResult.Keys.Count | Should -Be 4
$getTargetResourceResult.GroupName | Should -Be $script:testGroupName
$getTargetResourceResult.Ensure | Should -Be 'Present'
@@ -903,7 +903,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
Mock -CommandName 'Get-LocalGroup' -MockWith { Write-Error -Message 'Test error message' -CategoryReason 'GroupNotFoundException' }
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Absent' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Absent' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
}
@@ -911,7 +911,7 @@ Describe 'GroupResource Unit Tests' {
Context 'When Ensure is absent and the group exists' {
It 'Should return false and expected mocks are called' {
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Absent' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Absent' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
}
@@ -921,7 +921,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
Mock -CommandName 'Get-LocalGroup' -MockWith { Write-Error -Message 'Test error message' -CategoryReason 'GroupNotFoundException' }
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
}
@@ -937,7 +937,7 @@ Describe 'GroupResource Unit Tests' {
Context 'When Ensure is present and the group exists' {
It 'Should return true and expected mocks are called' {
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
}
@@ -947,7 +947,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
$script:testLocalGroup.Description = $script:testGroupDescription
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Description $script:testGroupDescription -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Description $script:testGroupDescription -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
}
@@ -957,7 +957,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
$script:testLocalGroup.Description = $script:testGroupDescription
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Description 'Wrong description' -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Description 'Wrong description' -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
}
@@ -967,7 +967,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
$testMembers = @( )
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -978,7 +978,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
$testMembers = @( $script:testMemberName1 )
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -989,7 +989,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
$testMembers = @( $script:testMemberName1 )
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -1000,7 +1000,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
$testMembers = @( $script:testMemberName1 )
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -1013,7 +1013,7 @@ Describe 'GroupResource Unit Tests' {
Mock -CommandName 'Get-MembersOnNanoServer' -MockWith { @( $script:testMemberName1, $script:testMemberName2 ) }
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -1026,7 +1026,7 @@ Describe 'GroupResource Unit Tests' {
Mock -CommandName 'Get-MembersOnNanoServer' -MockWith { @( $script:testMemberName1, $script:testMemberName2 ) }
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -1039,7 +1039,7 @@ Describe 'GroupResource Unit Tests' {
Mock -CommandName 'Get-MembersOnNanoServer' -MockWith { @( $script:testMemberName1, $script:testMemberName2 ) }
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -1053,7 +1053,7 @@ Describe 'GroupResource Unit Tests' {
Mock -CommandName 'Get-LocalGroup' -MockWith { return $script:testLocalGroup }
Mock -CommandName 'Get-MembersOnNanoServer' -MockWith { @( $script:testMemberName1, $script:testMemberName2 ) }
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnNanoServer -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-LocalGroup' -ParameterFilter { $Name -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Get-MembersOnNanoServer' -ParameterFilter { $Group.Name -eq $script:testGroupName }
@@ -1158,7 +1158,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
Assert-MockCalled -CommandName 'Remove-DisposableObject'
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
$getTargetResourceResult.Keys.Count | Should -Be 2
$getTargetResourceResult.GroupName | Should -Be $script:testGroupName
$getTargetResourceResult.Ensure | Should -Be 'Absent'
@@ -1177,7 +1177,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Get-MembersOnFullSKU' -ParameterFilter { $Group -eq $script:testGroup }
Assert-MockCalled -CommandName 'Remove-DisposableObject'
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
$getTargetResourceResult.Keys.Count | Should -Be 4
$getTargetResourceResult.GroupName | Should -Be $script:testGroupName
$getTargetResourceResult.Ensure | Should -Be 'Present'
@@ -1199,7 +1199,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Get-MembersOnFullSKU' -ParameterFilter { $Group -eq $script:testGroup }
Assert-MockCalled -CommandName 'Remove-DisposableObject'
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
$getTargetResourceResult.Keys.Count | Should -Be 4
$getTargetResourceResult.GroupName | Should -Be $script:testGroupName
$getTargetResourceResult.Ensure | Should -Be 'Present'
@@ -1770,7 +1770,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
Mock -CommandName 'Get-Group' -MockWith { }
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Absent' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Absent' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext' -Scope 'It'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName } -Scope 'It'
@@ -1780,7 +1780,7 @@ Describe 'GroupResource Unit Tests' {
Context 'When Ensure is absent and the group exists' {
It 'Should return false and expected mocks are called' {
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Absent' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Absent' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext' -Scope 'It'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName } -Scope 'It'
@@ -1792,7 +1792,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
Mock -CommandName 'Get-Group' -MockWith { }
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1802,7 +1802,7 @@ Describe 'GroupResource Unit Tests' {
Context 'When Ensure is present and the group exists' {
It 'Should return true and expected mocks are called' {
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1814,7 +1814,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
$script:testGroup.Description = $script:testGroupDescription
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Description $script:testGroupDescription -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Description $script:testGroupDescription -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1826,7 +1826,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
$script:testGroup.Description = $script:testGroupDescription
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Description 'Wrong description' -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Description 'Wrong description' -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1838,7 +1838,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
$testMembers = @( )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1851,7 +1851,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
$testMembers = @( $script:testUserPrincipal1.Name )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1864,7 +1864,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return false and expected mocks are called' {
$testMembers = @( $script:testUserPrincipal1.Name )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1877,7 +1877,7 @@ Describe 'GroupResource Unit Tests' {
It 'Should return true and expected mocks are called' {
$testMembers = @( $script:testUserPrincipal1.Name )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1892,7 +1892,7 @@ Describe 'GroupResource Unit Tests' {
$testMembers = @( $script:testUserPrincipal1.Name )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToExclude $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1907,7 +1907,7 @@ Describe 'GroupResource Unit Tests' {
$testMembers = @( $script:testUserPrincipal1.Name )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -MembersToInclude $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1922,7 +1922,7 @@ Describe 'GroupResource Unit Tests' {
$testMembers = @( $script:testUserPrincipal1, $script:testUserPrincipal2 )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $true
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -1937,7 +1937,7 @@ Describe 'GroupResource Unit Tests' {
$testMembers = @( $script:testUserPrincipal1, $script:testUserPrincipal3 )
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -Be $false
Test-TargetResourceOnFullSKU -GroupName $script:testGroupName -Members $testMembers -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-PrincipalContext'
Assert-MockCalled -CommandName 'Get-Group' -ParameterFilter { $GroupName -eq $script:testGroupName }
@@ -2422,9 +2422,9 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'Test-IsLocalMachine' -ParameterFilter { $Scope -eq $localScope }
Assert-MockCalled -CommandName 'New-Object' -ParameterFilter { $TypeName -eq 'System.DirectoryServices.AccountManagement.PrincipalContext' -and $ArgumentList.Contains($localMachineContext) }
$principalContextCache.ContainsKey($localScope) | Should -Be $false
$principalContextCache.ContainsKey($localScope) | Should -BeFalse
$principalContextCache.$script:localDomain | Should -Be $fakePrincipalContext
$disposables.Contains($fakePrincipalContext) | Should -Be $true
$disposables.Contains($fakePrincipalContext) | Should -BeTrue
}
}
@@ -2441,7 +2441,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'New-Object' -ParameterFilter { $TypeName -eq 'System.DirectoryServices.AccountManagement.PrincipalContext' } -Times 0 -Scope 'It'
$principalContextCache.$script:localDomain | Should -Not -Be $fakePrincipalContext
$disposables.Contains($fakePrincipalContext) | Should -Be $false
$disposables.Contains($fakePrincipalContext) | Should -BeFalse
}
}
@@ -2462,7 +2462,7 @@ Describe 'GroupResource Unit Tests' {
(Compare-Object -ReferenceObject $principalContextArgumentList -DifferenceObject $ArgumentList) -eq $null }
$principalContextCache.$customDomain | Should -Be $fakePrincipalContext
$disposables.Contains($fakePrincipalContext) | Should -Be $true
$disposables.Contains($fakePrincipalContext) | Should -BeTrue
}
}
@@ -2483,7 +2483,7 @@ Describe 'GroupResource Unit Tests' {
(Compare-Object -ReferenceObject $principalContextArgumentList -DifferenceObject $ArgumentList) -eq $null }
$principalContextCache.$customDomain | Should -Be $fakePrincipalContext
$disposables.Contains($fakePrincipalContext) | Should -Be $true
$disposables.Contains($fakePrincipalContext) | Should -BeTrue
}
}
@@ -2510,7 +2510,7 @@ Describe 'GroupResource Unit Tests' {
(Compare-Object -ReferenceObject $principalContextArgumentList -DifferenceObject $ArgumentList) -eq $null }
$principalContextCache.$customDomain | Should -Be $fakePrincipalContext
$disposables.Contains($fakePrincipalContext) | Should -Be $true
$disposables.Contains($fakePrincipalContext) | Should -BeTrue
}
}
@@ -2527,7 +2527,7 @@ Describe 'GroupResource Unit Tests' {
Assert-MockCalled -CommandName 'New-Object' -ParameterFilter { $TypeName -eq 'System.DirectoryServices.AccountManagement.PrincipalContext' } -Times 0 -Scope 'It'
$principalContextCache.$customDomain | Should -Not -Be $fakePrincipalContext
$disposables.Contains($fakePrincipalContext) | Should -Be $false
$disposables.Contains($fakePrincipalContext) | Should -BeFalse
}
}
}
+41 -38
View File
@@ -70,7 +70,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return 5 hashtable properties' {
@@ -138,7 +138,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return 5 hashtable properties' {
@@ -216,7 +216,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return 5 hashtable properties' {
@@ -312,7 +312,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return 5 hashtable properties' {
@@ -405,7 +405,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return 5 hashtable properties' {
@@ -1902,11 +1902,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return True' {
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
@@ -1943,11 +1943,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2004,11 +2004,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return True' {
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
@@ -2050,11 +2050,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2097,11 +2097,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2138,11 +2138,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return True' {
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
@@ -2184,11 +2184,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2231,11 +2231,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2278,11 +2278,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2324,11 +2324,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return True' {
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
@@ -2379,11 +2379,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return True' {
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
@@ -2443,11 +2443,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return True' {
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
}
@@ -2498,11 +2498,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -2566,11 +2566,11 @@ try
$testTargetResourceResult = Test-TargetResource @testTargetResourceParameters
It 'Should return a boolean' {
$testTargetResourceResult -is [System.Boolean] | Should -Be $true
$testTargetResourceResult -is [System.Boolean] | Should -BeTrue
}
It 'Should return False' {
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
}
@@ -3491,7 +3491,7 @@ try
$testRegistryKeyValuesMatchResult = Test-RegistryKeyValuesMatch @testRegistryKeyValuesMatchParameters
It 'Should return true' {
$testRegistryKeyValuesMatchResult | Should -Be $true
$testRegistryKeyValuesMatchResult | Should -BeTrue
}
}
@@ -3509,7 +3509,7 @@ try
$testRegistryKeyValuesMatchResult = Test-RegistryKeyValuesMatch @testRegistryKeyValuesMatchParameters
It 'Should return false' {
$testRegistryKeyValuesMatchResult | Should -Be $false
$testRegistryKeyValuesMatchResult | Should -BeFalse
}
}
}
@@ -3680,7 +3680,8 @@ try
$convertToDWordResult = ConvertTo-DWord @convertToDWordParameters
It 'Should return 0 as an Int32' {
$convertToDWordResult | Should -Be ([System.Int32] 0)
$convertToDWordResult | Should -BeOfType Int32
$convertToDWordResult | Should -BeExactly 0
}
}
@@ -3696,7 +3697,8 @@ try
$convertToDWordResult = ConvertTo-DWord @convertToDWordParameters
It 'Should return 0 as an Int32' {
$convertToDWordResult | Should -Be ([System.Int32] 0)
$convertToDWordResult | Should -BeOfType Int32
$convertToDWordResult | Should -BeExactly 0
}
}
@@ -3712,7 +3714,8 @@ try
$convertToDWordResult = ConvertTo-DWord @convertToDWordParameters
It 'Should return 0 as an Int32' {
$convertToDWordResult | Should -Be ([System.Int32] 0)
$convertToDWordResult | Should -BeOfType Int32
$convertToDWordResult | Should -BeExactly 0
}
}
+4 -4
View File
@@ -98,7 +98,7 @@ try
It 'Should return a hashtable' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the output from the specified get script' {
@@ -136,7 +136,7 @@ try
It 'Should return a hashtable' {
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should return the output from the specified get script' {
@@ -386,12 +386,12 @@ try
It 'Should return an error record' {
$scriptExecutionHelperResult = Invoke-Script @scriptExecutionHelperParameters
$scriptExecutionHelperResult -is [System.Management.Automation.ErrorRecord] | Should -Be $true
$scriptExecutionHelperResult -is [System.Management.Automation.ErrorRecord] | Should -BeTrue
}
It 'Should return an error record' {
$scriptExecutionHelperResult = Invoke-Script @scriptExecutionHelperParameters
$scriptExecutionHelperResult -is [System.Management.Automation.ErrorRecord] | Should -Be $true
$scriptExecutionHelperResult -is [System.Management.Automation.ErrorRecord] | Should -BeTrue
}
It 'Should return error with expected message from script' {
+21 -23
View File
@@ -61,7 +61,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [Hashtable] | Should Be $true
$getTargetResourceResult -is [Hashtable] | Should -BeTrue
}
It 'Should return the service name' {
@@ -123,7 +123,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [Hashtable] | Should Be $true
$getTargetResourceResult -is [Hashtable] | Should -BeTrue
}
It 'Should return the service name' {
@@ -212,7 +212,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [Hashtable] | Should Be $true
$getTargetResourceResult -is [Hashtable] | Should -BeTrue
}
It 'Should return the service name' {
@@ -308,7 +308,7 @@ try
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
It 'Should return a hashtable' {
$getTargetResourceResult -is [Hashtable] | Should Be $true
$getTargetResourceResult -is [Hashtable] | Should -BeTrue
}
It 'Should return the service name' {
@@ -970,7 +970,7 @@ try
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1001,7 +1001,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
@@ -1047,7 +1047,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
@@ -1078,7 +1078,7 @@ try
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1106,7 +1106,7 @@ try
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1133,8 +1133,6 @@ try
{ Test-TargetResource @testTargetResourceParameters } | Should -Not -Throw
}
if ($mismatchingParameterName -eq 'StartupType')
{
It 'Should check for a startup type and state conflict' {
@@ -1161,7 +1159,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
}
@@ -1194,7 +1192,7 @@ try
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1238,7 +1236,7 @@ try
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
@@ -1270,7 +1268,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
@@ -1314,7 +1312,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
}
@@ -1363,7 +1361,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
@@ -1394,7 +1392,7 @@ try
}
It 'Should return true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
Test-TargetResource @testTargetResourceParameters | Should -BeTrue
}
}
}
@@ -1429,7 +1427,7 @@ try
}
It 'Should return false' {
Test-TargetResource @testTargetResourceParameters | Should -Be $false
Test-TargetResource @testTargetResourceParameters | Should -BeFalse
}
}
}
@@ -1534,13 +1532,13 @@ try
Context 'Specified paths match' {
It 'Should return true' {
$matchingPath = 'MatchingPath'
Test-PathsMatch -ExpectedPath $matchingPath -ActualPath $matchingPath | Should -Be $true
Test-PathsMatch -ExpectedPath $matchingPath -ActualPath $matchingPath | Should -BeTrue
}
}
Context 'Specified paths do not match' {
It 'Should return false' {
Test-PathsMatch -ExpectedPath 'Path1' -ActualPath 'Path2' | Should -Be $false
Test-PathsMatch -ExpectedPath 'Path1' -ActualPath 'Path2' | Should -BeFalse
}
}
}
@@ -1631,7 +1629,7 @@ try
}
It 'Should return false' {
Set-ServicePath @setServicePathParameters | Should -Be $false
Set-ServicePath @setServicePathParameters | Should -BeFalse
}
}
@@ -1660,7 +1658,7 @@ try
}
It 'Should return true' {
Set-ServicePath @setServicePathParameters | Should -Be $true
Set-ServicePath @setServicePathParameters | Should -BeTrue
}
}
+20 -20
View File
@@ -584,7 +584,7 @@ try {
-Disabled (-not $existingUserValues.Enabled) `
-PasswordNeverExpires $existingUserValues.PasswordNeverExpires `
-PasswordChangeNotAllowed $existingUserValues.UserCanNotChangePassword
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
Assert-MockCalled -CommandName Find-UserByNameOnFullSku -Exactly 1 -Scope It
Assert-MockCalled -CommandName Test-UserPasswordOnFullSku -Exactly 1 -Scope It
@@ -593,19 +593,19 @@ try {
It 'Should return true when user Absent and Ensure = Absent' {
$testTargetResourceResult = Test-TargetResource -UserName $absentUserName `
-Ensure 'Absent'
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false when user Absent and Ensure = Present' {
$testTargetResourceResult = Test-TargetResource -UserName $absentUserName `
-Ensure 'Present'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when user Present and Ensure = Absent' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Ensure 'Absent'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when Password is wrong' {
@@ -613,7 +613,7 @@ try {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Password $newUserValues.Password
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Find-UserByNameOnFullSku -Exactly 1 -Scope It
Assert-MockCalled -CommandName Test-UserPasswordOnFullSku -Exactly 1 -Scope It
@@ -622,33 +622,33 @@ try {
It 'Should return false when user Present and wrong Description' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Description 'Wrong description'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when FullName is incorrect' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-FullName 'Wrong FullName'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when Disabled is incorrect' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Disabled $existingUserValues.Enabled
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when PasswordNeverExpires is incorrect' {
$testTargetResourceResult = Test-TargetResource `
-UserName $existingUserName `
-PasswordNeverExpires (-not $existingUserValues.PasswordNeverExpires)
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when PasswordChangeNotAllowed is incorrect' {
$testTargetResourceResult = Test-TargetResource `
-UserName $existingUserName `
-PasswordChangeNotAllowed $existingUserValues.UserMayChangePassword
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -673,7 +673,7 @@ try {
-Disabled (-not $existingUserValues.Enabled) `
-PasswordNeverExpires $existingUserValues.PasswordNeverExpires `
-PasswordChangeNotAllowed $existingUserValues.UserCanNotChangePassword
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
Assert-MockCalled -CommandName Find-UserByNameOnNanoServer -Exactly 1 -Scope It
Assert-MockCalled -CommandName Test-CredentialsValidOnNanoServer -Exactly 1 -Scope It
@@ -682,19 +682,19 @@ try {
It 'Should return true when user Absent and Ensure = Absent' {
$testTargetResourceResult = Test-TargetResource -UserName $absentUserName `
-Ensure 'Absent'
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false when user Absent and Ensure = Present' {
$testTargetResourceResult = Test-TargetResource -UserName $absentUserName `
-Ensure 'Present'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when user Present and Ensure = Absent' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Ensure 'Absent'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when Password is wrong' {
@@ -702,7 +702,7 @@ try {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Password $newUserValues.Password
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Find-UserByNameOnNanoServer -Exactly 1 -Scope It
Assert-MockCalled -CommandName Test-CredentialsValidOnNanoServer -Exactly 1 -Scope It
@@ -711,33 +711,33 @@ try {
It 'Should return false when user Present and wrong Description' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Description 'Wrong description'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when FullName is incorrect' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-FullName 'Wrong FullName'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when Disabled is incorrect' {
$testTargetResourceResult = Test-TargetResource -UserName $existingUserName `
-Disabled $existingUserValues.Enabled
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when PasswordNeverExpires is incorrect' {
$testTargetResourceResult = Test-TargetResource `
-UserName $existingUserName `
-PasswordNeverExpires (-not $existingUserValues.PasswordNeverExpires)
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return false when PasswordChangeNotAllowed is incorrect' {
$testTargetResourceResult = Test-TargetResource `
-UserName $existingUserName `
-PasswordChangeNotAllowed $existingUserValues.UserMayChangePassword
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should throw an Invalid Operation exception when there are multiple users with the given name' {
+16 -16
View File
@@ -189,7 +189,7 @@ try
$getTargetResourceResult.Name | Should -Be $testWindowsFeatureName2
$getTargetResourceResult.DisplayName | Should -Be $mockWindowsFeatures[$testWindowsFeatureName2].DisplayName
$getTargetResourceResult.Ensure | Should -Be 'Present'
$getTargetResourceResult.IncludeAllSubFeature | Should -Be $false
$getTargetResourceResult.IncludeAllSubFeature | Should -BeFalse
}
It 'Should return the correct hashtable when on a 2008 Server' {
@@ -199,7 +199,7 @@ try
$getTargetResourceResult.Name | Should -Be $testWindowsFeatureName2
$getTargetResourceResult.DisplayName | Should -Be $mockWindowsFeatures[$testWindowsFeatureName2].DisplayName
$getTargetResourceResult.Ensure | Should -Be 'Present'
$getTargetResourceResult.IncludeAllSubFeature | Should -Be $false
$getTargetResourceResult.IncludeAllSubFeature | Should -BeFalse
}
It 'Should return the correct hashtable when on a 2008 Server and Credential is passed' {
@@ -216,7 +216,7 @@ try
$getTargetResourceResult.Name | Should -Be $testWindowsFeatureName2
$getTargetResourceResult.DisplayName | Should -Be $mockWindowsFeatures[$testWindowsFeatureName2].DisplayName
$getTargetResourceResult.Ensure | Should -Be 'Present'
$getTargetResourceResult.IncludeAllSubFeature | Should -Be $false
$getTargetResourceResult.IncludeAllSubFeature | Should -BeFalse
Assert-MockCalled -CommandName Invoke-Command -Times 1 -Exactly -Scope It
}
@@ -231,7 +231,7 @@ try
$getTargetResourceResult.Name | Should -Be $testWindowsFeatureName1
$getTargetResourceResult.DisplayName | Should -Be $mockWindowsFeatures[$testWindowsFeatureName1].DisplayName
$getTargetResourceResult.Ensure | Should -Be 'Absent'
$getTargetResourceResult.IncludeAllSubFeature | Should -Be $true
$getTargetResourceResult.IncludeAllSubFeature | Should -BeTrue
Assert-MockCalled -CommandName Test-IsWinServer2008R2SP1 -Times 1 -Exactly -Scope It
}
@@ -244,7 +244,7 @@ try
$getTargetResourceResult.Name | Should -Be $testWindowsFeatureName1
$getTargetResourceResult.DisplayName | Should -Be $mockWindowsFeatures[$testWindowsFeatureName1].DisplayName
$getTargetResourceResult.Ensure | Should -Be 'Absent'
$getTargetResourceResult.IncludeAllSubFeature | Should -Be $false
$getTargetResourceResult.IncludeAllSubFeature | Should -BeFalse
Assert-MockCalled -CommandName Test-IsWinServer2008R2SP1 -Times 1 -Exactly -Scope It
@@ -444,7 +444,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Absent' `
-IncludeAllSubFeature $false
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
Assert-MockCalled -CommandName Get-WindowsFeature -Times 1 -Exactly -Scope It
}
@@ -455,7 +455,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Present' `
-IncludeAllSubFeature $false
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
Assert-MockCalled -CommandName Get-WindowsFeature -Times 1 -Exactly -Scope It
$mockWindowsFeatures[$testWindowsFeatureName1].Installed = $false
}
@@ -467,7 +467,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Present' `
-IncludeAllSubFeature $true
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
Assert-MockCalled -CommandName Get-WindowsFeature -Times 4 -Exactly -Scope It
$mockWindowsFeatures[$testWindowsFeatureName1].Installed = $false
}
@@ -479,7 +479,7 @@ try
-Ensure 'Absent' `
-IncludeAllSubFeature $false `
-Credential $testCredential
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
Assert-MockCalled -CommandName Invoke-Command -Times 1 -Exactly -Scope It
}
}
@@ -491,7 +491,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Present' `
-IncludeAllSubFeature $false
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Get-WindowsFeature -Times 1 -Exactly -Scope It
}
@@ -500,7 +500,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Absent' `
-IncludeAllSubFeature $false
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Get-WindowsFeature -Times 1 -Exactly -Scope It
$mockWindowsFeatures[$testWindowsFeatureName1].Installed = $false
}
@@ -509,7 +509,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Present' `
-IncludeAllSubFeature $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Get-WindowsFeature -Times 1 -Exactly -Scope It
}
@@ -517,7 +517,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Absent' `
-IncludeAllSubFeature $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Get-WindowsFeature -Times 2 -Exactly -Scope It
}
@@ -526,7 +526,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Absent' `
-IncludeAllSubFeature $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Get-WindowsFeature -Times 1 -Exactly -Scope It
$mockWindowsFeatures[$testWindowsFeatureName1].Installed = $false
}
@@ -537,7 +537,7 @@ try
$testTargetResourceResult = Test-TargetResource -Name $testWindowsFeatureName1 `
-Ensure 'Present' `
-IncludeAllSubFeature $true
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Get-WindowsFeature -Times 3 -Exactly -Scope It
$mockWindowsFeatures[$testWindowsFeatureName1].Installed = $false
$mockWindowsFeatures[$testSubFeatureName2].Installed = $true
@@ -550,7 +550,7 @@ try
-Ensure 'Present' `
-IncludeAllSubFeature $false `
-Credential $testCredential
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
Assert-MockCalled -CommandName Invoke-Command -Times 1 -Exactly -Scope It
}
}
@@ -64,11 +64,11 @@ try
}
It 'Should throw when the DISM module is not available' {
Mock Import-Module -ParameterFilter { $Name -eq 'Dism' } -MockWith { Write-Error 'Cannot find module' }
Mock -CommandName Import-Module -ParameterFilter { $Name -eq 'Dism' } -MockWith { Write-Error 'Cannot find module' }
{ Assert-ResourcePrerequisitesValid } | Should -Throw -ExpectedMessage $script:localizedData.DismNotAvailable
}
Mock Import-Module -ParameterFilter { $Name -eq 'Dism' } -MockWith { }
Mock -CommandName Import-Module -ParameterFilter { $Name -eq 'Dism' } -MockWith { }
It 'Should throw when operating system is Server 2008 R2' {
Mock Get-CimInstance -ParameterFilter { $ClassName -eq 'Win32_OperatingSystem' } -MockWith { return $fakeWin32OSObjects['Server2008R2'] }
@@ -102,7 +102,7 @@ try
It 'Should return a Hashtable' {
$getTargetResourceResult = Get-TargetResource -Name $script:testFeatureName
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -Be $true
$getTargetResourceResult -is [System.Collections.Hashtable] | Should -BeTrue
}
It 'Should call Assert-ResourcePrerequisitesValid with the feature name' {
@@ -132,11 +132,11 @@ try
Mock Dism\Get-WindowsOptionalFeature { $FeatureName -eq $script:testFeatureName } -MockWith { return $script:fakeEnabledFeature }
It 'Should return true when Ensure set to Present' {
Test-TargetResource -Name $testFeatureName -Ensure 'Present' | Should -Be $true
Test-TargetResource -Name $testFeatureName -Ensure 'Present' | Should -BeTrue
}
It 'Should return false when Ensure set to Absent' {
Test-TargetResource -Name $testFeatureName -Ensure 'Absent' | Should -Be $false
Test-TargetResource -Name $testFeatureName -Ensure 'Absent' | Should -BeFalse
}
}
@@ -146,11 +146,11 @@ try
Mock Dism\Get-WindowsOptionalFeature { $FeatureName -eq $script:testFeatureName } -MockWith { return $script:fakeDisabledFeature }
It 'Should return false when Ensure set to Present' {
Test-TargetResource -Name $testFeatureName -Ensure 'Present' | Should -Be $false
Test-TargetResource -Name $testFeatureName -Ensure 'Present' | Should -BeFalse
}
It 'Should return true when Ensure set to Absent' {
Test-TargetResource -Name $testFeatureName -Ensure 'Absent' | Should -Be $true
Test-TargetResource -Name $testFeatureName -Ensure 'Absent' | Should -BeTrue
}
}
@@ -159,11 +159,11 @@ try
Mock Dism\Get-WindowsOptionalFeature { $FeatureName -eq $script:testFeatureName } -MockWith { }
It 'Should return false when Ensure set to Present' {
Test-TargetResource -Name $testFeatureName -Ensure 'Present' | Should -Be $false
Test-TargetResource -Name $testFeatureName -Ensure 'Present' | Should -BeFalse
}
It 'Should return true when Ensure set to Absent' {
Test-TargetResource -Name $testFeatureName -Ensure 'Absent' | Should -Be $true
Test-TargetResource -Name $testFeatureName -Ensure 'Absent' | Should -BeTrue
}
}
@@ -314,7 +314,7 @@ try
foreach ($objectNumber in @(1, 2, 3))
{
$propertiesAsStrings.Contains("Name = Object $objectNumber, Value = Value $objectNumber, Path = Path $objectNumber") | Should -Be $true
$propertiesAsStrings.Contains("Name = Object $objectNumber, Value = Value $objectNumber, Path = Path $objectNumber") | Should -BeTrue
}
}
}
+4 -4
View File
@@ -107,24 +107,24 @@ try
Mock -CommandName 'Get-TargetResource' -MockWith { return @{ Ensure = 'Absent' } }
It 'Should return true when Get-TargetResource returns Ensure Absent and Ensure is set to Absent' {
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Absent' | Should -Be $true
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Absent' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-TargetResource'
}
It 'Should return false when Get-TargetResource returns Ensure Absent and Ensure is set to Present' {
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Present' | Should -Be $false
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Present' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-TargetResource'
}
Mock -CommandName 'Get-TargetResource' -MockWith { return @{ Ensure = 'Present' } }
It 'Should return true when Get-TargetResource returns Ensure Present and Ensure is set to Present' {
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Present' | Should -Be $true
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Present' | Should -BeTrue
Assert-MockCalled -CommandName 'Get-TargetResource'
}
It 'Should return false when Get-TargetResource returns Ensure Present and Ensure is set to Absent' {
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Absent' | Should -Be $false
Test-TargetResource -Name $script:testPackageName -SourcePath $script:testSourcePath -Ensure 'Absent' | Should -BeFalse
Assert-MockCalled -CommandName 'Get-TargetResource'
}
+6 -6
View File
@@ -409,14 +409,14 @@ try
$testTargetResourceResult = Test-TargetResource -Path $script:validPath1 `
-Arguments $script:mockProcess1.Arguments `
-Ensure 'Present'
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false when Ensure set to Present and process is not running' {
$testTargetResourceResult = Test-TargetResource -Path $script:invalidPath `
-Arguments $script:mockProcess1.Arguments `
-Ensure 'Present'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
It 'Should return true when Ensure set to Absent and process is not running and Credential passed' {
@@ -424,14 +424,14 @@ try
-Arguments $script:mockProcess1.Arguments `
-Credential $script:testCredential `
-Ensure 'Absent'
$testTargetResourceResult | Should -Be $true
$testTargetResourceResult | Should -BeTrue
}
It 'Should return false when Ensure set to Absent and process is running' {
$testTargetResourceResult = Test-TargetResource -Path $script:validPath1 `
-Arguments $script:mockProcess1.Arguments `
-Ensure 'Absent'
$testTargetResourceResult | Should -Be $false
$testTargetResourceResult | Should -BeFalse
}
}
@@ -667,14 +667,14 @@ try
It 'Should return true when all processes are returned' {
$processCountResult = Wait-ProcessCount -ProcessSettings $mockProcessSettings -ProcessCount 2
$processCountResult | Should -Be $true
$processCountResult | Should -BeTrue
}
It 'Should return false when not all processes are returned' {
$processCountResult = Wait-ProcessCount -ProcessSettings $mockProcessSettings `
-ProcessCount 3 `
-WaitTime 10
$processCountResult | Should -Be $false
$processCountResult | Should -BeFalse
}
}
+5 -5
View File
@@ -51,10 +51,10 @@ InModuleScope 'ResourceSetHelper' {
$keyParameterName = 'Name'
$commonParameterString = New-ResourceSetCommonParameterString -KeyParameterName $keyParameterName -Parameters $parameters
$commonParameterString.Contains("CommonStringParameter1 = `"CommonParameter1`"`r`n") | Should -Be $true
$commonParameterString.Contains("CommonStringParameter2 = `"CommonParameter2`"`r`n") | Should -Be $true
$commonParameterString.Contains("CommonIntParameter1 = `$CommonIntParameter1`r`n") | Should -Be $true
$commonParameterString.Contains("CommonIntParameter2 = `$CommonIntParameter2`r`n") | Should -Be $true
$commonParameterString.Contains("CommonStringParameter1 = `"CommonParameter1`"`r`n") | Should -BeTrue
$commonParameterString.Contains("CommonStringParameter2 = `"CommonParameter2`"`r`n") | Should -BeTrue
$commonParameterString.Contains("CommonIntParameter1 = `$CommonIntParameter1`r`n") | Should -BeTrue
$commonParameterString.Contains("CommonIntParameter2 = `$CommonIntParameter2`r`n") | Should -BeTrue
}
}
@@ -104,7 +104,7 @@ InModuleScope 'ResourceSetHelper' {
$newResourceSetConfigurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams
It 'Should return a ScriptBlock' {
$newResourceSetConfigurationScriptBlock -is [System.Management.Automation.ScriptBlock] | Should -Be $true
$newResourceSetConfigurationScriptBlock -is [System.Management.Automation.ScriptBlock] | Should -BeTrue
}
It 'Should return ScriptBlock of string returned from New-ResourceSetConfigurationString' {