PowerShell/test/powershell/Add-Member.Tests.ps1

20 lines
673 B
PowerShell
Raw Normal View History

2015-10-23 01:35:31 +02:00
Describe "Add-Member" {
2015-07-24 19:38:51 +02:00
2015-07-15 19:15:39 +02:00
It "should be able to see a newly added member of an object" {
$o = New-Object psobject
Add-Member -InputObject $o -MemberType NoteProperty -Name proppy -Value "superVal"
2015-07-15 19:15:39 +02:00
$o.proppy | Should Not BeNullOrEmpty
$o.proppy | Should Be "superVal"
2015-07-15 19:15:39 +02:00
}
It "Should be able to add a member to an object that already has a member in it" {
$o = New-Object psobject
Add-Member -InputObject $o -MemberType NoteProperty -Name proppy -Value "superVal"
Add-Member -InputObject $o -MemberType NoteProperty -Name AnotherMember -Value "AnotherValue"
2015-07-15 19:15:39 +02:00
$o.AnotherMember | Should Not BeNullOrEmpty
$o.AnotherMember | Should Be "AnotherValue"
2015-07-15 19:15:39 +02:00
}
}