Closed plastikfan closed 3 years ago
Some temp test code:
Context 'test psobject props' {
It '*** does it work?' -Skip {
[PSCustomObject]$testObject = [PSCustomObject]@{
Activate = $false;
}
[string]$field = 'Activate'
if ($testObject.psobject.properties.match($field)) {
Write-Host "Activate is present: $($testObject.$field)";
}
else {
Write-Host "Activate is NOT present";
}
# $Object.psobject.properties.match($Field)
if ($testObject.psobject.properties.match($field)) {
Write-Host "Activate is present: $($testObject.$field)";
}
else {
Write-Host "Activate is NOT present";
}
# if (Get-PsObjectField -Object $testObject -Field $field) {
# Write-Host "Activate is present: $($testObject.$field)";
# }
# else {
# # false negative
# Write-Host "Activate is NOT present";
# }
# [string]$field = 'Activate'
# if ($testObject.psobject.properties.match('Activate').Count) {
# Write-Host "$field is present: $($testObject.$field)";
# }
# else {
# Write-Host "$field is NOT present";
# }
}
}
Maybe this is caused by the fact that you need to use the Count property
$object.psobject.properties.match('WithLead').Count
Had to fix a bug in Rename-Many (from working on bootstrap, issue #112), where Except was mistyped as Exclude
commit 9d23c9ec6b563d4f1019a6bddb4bce2b8ab7d3dd, was checked in without the corresponding issue number inserted
This has created a hidden bug inside Format-StructuredLine causing the following test failures:
When an initial attempt to fix the issue by setting $withLead:
instead of using Get-PsObjectField