forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PowerShell#1512 from PowerShell/vors/add-type
Add-Type: add mscorlib.dll to the list of default references
- Loading branch information
Showing
3 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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
16 changes: 15 additions & 1 deletion
16
test/powershell/Modules/Microsoft.PowerShell.Utility/Add-Type.Tests.ps1
This file contains 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 |
---|---|---|
@@ -1,5 +1,19 @@ | ||
$guid = [Guid]::NewGuid().ToString().Replace("-","") | ||
|
||
Describe "Add-Type" { | ||
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 | ||
} | ||
|
||
It "Can load TPA assembly System.Runtime.Serialization.Primitives.dll" { | ||
Add-Type -AssemblyName 'System.Runtime.Serialization.Primitives' -PassThru | Should Not Be $null | ||
} | ||
} |