-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Use new Pester syntax: -Parameter for Pester tests in Microsoft.PowerShell.Management module. #6294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TravisEz13
merged 21 commits into
PowerShell:master
from
kalgiz:new-pester-parameter-syntax
Mar 9, 2018
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6e0b7dc
Clean up tests in Microsoft.PowerShell.Management to use -Parameter s…
kalgiz 6fb3282
[Feature] Merge branch 'master' of https://github.com/kalgiz/PowerShe…
kalgiz a453e49
Add line deleted by mistake.
kalgiz 2645036
[Feature] Resolve conflict
kalgiz f7e6998
Merge branch 'master' of https://github.com/kalgiz/PowerShell into ne…
kalgiz 8661ef7
Tests syntax correction for module Microsoft.PowerShell.Management
kalgiz ec1292f
Tests syntax correction for module Microsoft.PowerShell.Management
kalgiz 170da9f
Test correction
kalgiz b591202
[Feature] Tests correction in module Microsoft.PowerShell.Management.
kalgiz 3113dcb
[Feature] Clear-Content test correction.
kalgiz 57a2688
[Feature] Test correction.
kalgiz f4955aa
Merge branch 'master' of https://github.com/kalgiz/PowerShell into ne…
kalgiz 030ffa0
[Feature] Microsoft.PowerShell.Management module tests.
kalgiz 5a0c067
[Feature] Remove-EventLog test correction.
kalgiz 9c93d1a
[Feature] Use Should -Throw -ErrorId instead of try-catch in module M…
kalgiz ddff370
Merge branch 'master' of https://github.com/kalgiz/PowerShell into ne…
kalgiz 7531e93
[Feature] Tests correction in Microsoft.PowerShell.Managemet module.
kalgiz 67ff3ef
[Feature] Merge branch 'master' of https://github.com/kalgiz/PowerShe…
kalgiz f0cc737
[Feature] Tests correction in Microsoft.PowerShell.Managemet module.
kalgiz ea48f96
Merge branch 'master' of https://github.com/kalgiz/PowerShell into ne…
kalgiz fda9da7
[Feature] Tests correction
kalgiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Tests syntax correction for module Microsoft.PowerShell.Management
- Loading branch information
commit ec1292f7bc3e42afa866e3f58faf66f2ee5b33a7
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1008,7 +1008,7 @@ try { | |
|
||
It "Verify type returned by Get-ComputerInfo" { | ||
$computerInfo = Get-ComputerInfo | ||
$computerInfo | Should -BeOfType Microsoft.PowerShell.Commands.ComputerInfo | ||
$computerInfo | Should -BeOfType 'Microsoft.PowerShell.Commands.ComputerInfo' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For any |
||
} | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ Describe "Get-Content" -Tags "CI" { | |
|
||
It "Should return an Object when listing only a single line and the correct information from a file" { | ||
$content = (Get-Content -Path $testPath) | ||
$content | Should -Be $testString | ||
$content | Should -BeExactly $testString | ||
$content.Count | Should -Be 1 | ||
$content | Should -BeOfType "System.String" | ||
} | ||
|
@@ -48,40 +48,40 @@ Describe "Get-Content" -Tags "CI" { | |
} | ||
|
||
It "Should be able to return a specific line from a file" { | ||
(Get-Content -Path $testPath2)[1] | Should -Be $secondline | ||
(Get-Content -Path $testPath2)[1] | Should -BeExactly $secondline | ||
} | ||
|
||
It "Should be able to specify the number of lines to get the content of using the TotalCount switch" { | ||
$returnArray = (Get-Content -Path $testPath2 -TotalCount 2) | ||
$returnArray[0] | Should -Be $firstline | ||
$returnArray[1] | Should -Be $secondline | ||
$returnArray[0] | Should -BeExactly $firstline | ||
$returnArray[1] | Should -BeExactly $secondline | ||
} | ||
|
||
It "Should be able to specify the number of lines to get the content of using the Head switch" { | ||
$returnArray = (Get-Content -Path $testPath2 -Head 2) | ||
$returnArray[0] | Should -Be $firstline | ||
$returnArray[1] | Should -Be $secondline | ||
$returnArray[0] | Should -BeExactly $firstline | ||
$returnArray[1] | Should -BeExactly $secondline | ||
} | ||
|
||
It "Should be able to specify the number of lines to get the content of using the First switch" { | ||
$returnArray = (Get-Content -Path $testPath2 -First 2) | ||
$returnArray[0] | Should -Be $firstline | ||
$returnArray[1] | Should -Be $secondline | ||
$returnArray[0] | Should -BeExactly $firstline | ||
$returnArray[1] | Should -BeExactly $secondline | ||
} | ||
|
||
It "Should return the last line of a file using the Tail switch" { | ||
Get-Content -Path $testPath -Tail 1 | Should -Be $testString | ||
Get-Content -Path $testPath -Tail 1 | Should -BeExactly $testString | ||
} | ||
|
||
It "Should return the last lines of a file using the Last alias" { | ||
Get-Content -Path $testPath2 -Last 1 | Should -Be $fifthline | ||
Get-Content -Path $testPath2 -Last 1 | Should -BeExactly $fifthline | ||
} | ||
|
||
It "Should be able to get content within a different drive" { | ||
Push-Location env: | ||
$expectedoutput = [Environment]::GetEnvironmentVariable("PATH"); | ||
{ Get-Content PATH } | Should -Not -Throw | ||
Get-Content PATH | Should -Be $expectedoutput | ||
Get-Content PATH | Should -BeExactly $expectedoutput | ||
Pop-Location | ||
} | ||
|
||
|
@@ -124,9 +124,9 @@ baz | |
$expected = 'foo' | ||
|
||
$actual = Get-Content -Path $testPath -Tail $tailCount -Encoding $encodingName | ||
$actual.GetType() | Should -Be "System.Object[]" | ||
$actual | Should -BeOfType "[string]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just |
||
$actual.Length | Should -Be $tailCount | ||
$actual[0] | Should -Be $expected | ||
$actual[0] | Should -BeExactly $expected | ||
} | ||
|
||
It "should Get-Content with a variety of -Tail and -ReadCount: <test>" -TestCases @( | ||
|
@@ -226,11 +226,11 @@ baz | |
|
||
It "Should support NTFS streams using -Stream" -Skip:(!$IsWindows) { | ||
Set-Content -Path $testPath -Stream hello -Value World | ||
Get-Content -Path $testPath | Should -Be $testString | ||
Get-Content -Path $testPath -Stream hello | Should -Be "World" | ||
Get-Content -Path $testPath | Should -BeExactly $testString | ||
Get-Content -Path $testPath -Stream hello | Should -BeExactly "World" | ||
$item = Get-Item -Path $testPath -Stream hello | ||
$item | Should -BeOfType System.Management.Automation.Internal.AlternateStreamData | ||
$item.Stream | Should -Be "hello" | ||
$item | Should -BeOfType 'System.Management.Automation.Internal.AlternateStreamData' | ||
$item.Stream | Should -BeExactly "hello" | ||
Clear-Content -Path $testPath -Stream hello | ||
Get-Content -Path $testPath -Stream hello | Should -BeNullOrEmpty | ||
Remove-Item -Path $testPath -Stream hello | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use
-belike "*$item_F*"
would give better error on failder