mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Improve Pester Test for New-object #476
This commit is contained in:
1 parent
25f8d334d6
commit
bd51520505
1 file changed
+26
@@ -13,4 +13,30 @@ Describe "New-Object" {
|
||||
$val.Name | Should Be 'PSCustomObject'
|
||||
$val.BaseType | Should Be 'System.Object'
|
||||
}
|
||||
|
||||
It "should create an object with using Property switch" {
|
||||
$hash = @{
|
||||
FirstVal = 'test1'
|
||||
SecondVal = 'test2'
|
||||
}
|
||||
$o = New-Object psobject -Property $hash
|
||||
|
||||
$o.FirstVal | Should Be 'test1'
|
||||
$o.SecondVal | Should Be 'test2'
|
||||
}
|
||||
|
||||
It "should create a .Net object with using ArgumentList switch" {
|
||||
$o = New-Object -TypeName System.Version -ArgumentList "1.2.3.4"
|
||||
$val = $o.GetType()
|
||||
|
||||
$o.Major | Should Be 1
|
||||
$o.Minor | Should Be 2
|
||||
$o.Build | Should Be 3
|
||||
$o.Revision | Should Be 4
|
||||
|
||||
$val.IsPublic | Should Be $true
|
||||
$val.IsSerializable | Should Be $false
|
||||
$val.Name | Should Be 'Version'
|
||||
$val.BaseType | Should Be 'System.Object'
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user