-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Use new Pester syntax: -Parameter for Pester tests in Utility #6359
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
Closed
KevinMarquette
wants to merge
24
commits into
PowerShell:master
from
loandepot-oss:kmarquette/6245-utility
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8ce4229
Should -Throw
KevinMarquette 88d4b28
Should -Not -Throw
KevinMarquette faee08a
Should -BeTrue
KevinMarquette ee37dab
Should -BeFalse
KevinMarquette 807cd5c
Should Not BeNullOrEmpty
KevinMarquette 0afa546
Should -BeNullOrEmpty
KevinMarquette ae8dc08
Should Not Be $Null -> Should -Not -BeNullOrEmpty
KevinMarquette fc13f42
Should Be $null -> Should -BeNullOrEmpty
KevinMarquette b51012c
Should Match
KevinMarquette e8d83c8
Should -Not -Match
KevinMarquette e110fbf
Should -Not -Be variable
KevinMarquette f5c5b23
Should -Be variable
KevinMarquette a423fd9
Should Be "" -> Should -BeNullOrEmpty
KevinMarquette a2b6b48
Should Not Be "" -> Should -Not -BeNullOrEmpty
KevinMarquette 5f8568b
Should -Not -<Command>
KevinMarquette 2d47f00
Should -Throw
KevinMarquette 034821d
Should -Be
KevinMarquette 0de5174
Should -<command>
KevinMarquette af92862
Should -Exist
KevinMarquette aa9ed16
Merge branch Master
KevinMarquette 453ae82
resolve merge conflict
KevinMarquette 2edcb2e
Merge remote-tracking branch 'origin/master' into kmarquette/6245-uti…
KevinMarquette e70de93
remove extra spaces after pester parameters
KevinMarquette b07ebe6
correct case
KevinMarquette 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
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 |
|---|---|---|
|
|
@@ -36,33 +36,33 @@ Describe "Add-Type" -Tags "CI" { | |
| } | ||
|
|
||
| It "Public 'Language' enumeration contains all members" { | ||
| [Enum]::GetNames("Microsoft.PowerShell.Commands.Language") -join "," | Should Be "CSharp,VisualBasic" | ||
| [Enum]::GetNames("Microsoft.PowerShell.Commands.Language") -join "," | Should -Be "CSharp,VisualBasic" | ||
| } | ||
|
|
||
| It "Should not throw given a simple class definition" { | ||
| { Add-Type -TypeDefinition "public static class foo { }" } | Should Not Throw | ||
| { Add-Type -TypeDefinition "public static class foo { }" } | Should -Not -Throw | ||
| } | ||
|
|
||
| It "Can use System.Management.Automation.CmdletAttribute" { | ||
| $code = @" | ||
| [System.Management.Automation.Cmdlet("Get", "Thing", ConfirmImpact = System.Management.Automation.ConfirmImpact.High, SupportsPaging = true)] | ||
| public class AttributeTest$guid {} | ||
| "@ | ||
| Add-Type -TypeDefinition $code -PassThru | Should Not Be $null | ||
| Add-Type -TypeDefinition $code -PassThru | Should -Not -BeNullOrEmpty | ||
| } | ||
|
|
||
| It "Can load TPA assembly System.Runtime.Serialization.Primitives.dll" { | ||
| Add-Type -AssemblyName 'System.Runtime.Serialization.Primitives' -PassThru | Should Not Be $null | ||
| Add-Type -AssemblyName 'System.Runtime.Serialization.Primitives' -PassThru | Should -Not -BeNullOrEmpty | ||
| } | ||
|
|
||
| It "Can compile C# files" { | ||
|
|
||
| { [Test.AddType.BasicTest1]::Add1(1, 2) } | Should Throw | ||
| { [Test.AddType.BasicTest2]::Add2(3, 4) } | Should Throw | ||
| { [Test.AddType.BasicTest1]::Add1(1, 2) } | Should -Throw | ||
|
Member
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. We should never have just |
||
| { [Test.AddType.BasicTest2]::Add2(3, 4) } | Should -Throw | ||
|
|
||
| Add-Type -Path $codeFile1,$codeFile2 | ||
|
|
||
| { [Test.AddType.BasicTest1]::Add1(1, 2) } | Should Not Throw | ||
| { [Test.AddType.BasicTest2]::Add2(3, 4) } | Should Not Throw | ||
| { [Test.AddType.BasicTest1]::Add1(1, 2) } | Should -Not -Throw | ||
| { [Test.AddType.BasicTest2]::Add2(3, 4) } | Should -Not -Throw | ||
| } | ||
| } | ||
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.
We should update these tests to use:
{ ...scriptblock... } | Should -Throw -ErrorId "...fully qualified error id..."