From 4fe69773d46e0a62a0702331229cfc0ef919a0fc Mon Sep 17 00:00:00 2001 From: George Fleming Date: Tue, 9 Feb 2016 15:59:07 -0800 Subject: [PATCH] Modified Get-ChildItem pester test to check for sorted list of files --- test/powershell/Get-ChildItem.Tests.ps1 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/powershell/Get-ChildItem.Tests.ps1 b/test/powershell/Get-ChildItem.Tests.ps1 index 52f50f58a..2b55d1ec0 100644 --- a/test/powershell/Get-ChildItem.Tests.ps1 +++ b/test/powershell/Get-ChildItem.Tests.ps1 @@ -22,4 +22,19 @@ $var.Length.Length | Should BeGreaterThan 0 } + + It "Should list files in sorted order" { + New-Item -Path $TestDrive -Name "a" -ItemType "File" -Force + New-Item -Path $TestDrive -Name "B" -ItemType "File" -Force + New-Item -Path $TestDrive -Name "c" -ItemType "File" -Force + New-Item -Path $TestDrive -Name "D" -ItemType "File" -Force + New-Item -Path $TestDrive -Name "E" -ItemType "Directory" -Force + + $files = Get-ChildItem -Path $TestDrive + $files[0].Name | Should Be "E" + $files[1].Name | Should Be "a" + $files[2].Name | Should Be "B" + $files[3].Name | Should Be "c" + $files[4].Name | Should Be "D" + } }