class TestHost : System.Management.Automation.Host.PSHost
{
[String]$myName = "MyHost"
[Version]$myVersion = [Version]"1.0.0.0"
[Guid]$myInstanceId = [guid]::NewGuid()
[System.Globalization.CultureInfo]$myCurrentCulture = "en-us"
[System.Globalization.CultureInfo]$myCurrentUICulture = "en-us"
[System.Management.Automation.Host.PSHostUserInterface]$myUI = $null
[bool]$IsInteractive
[void]SetShouldExit([int]$exitCode) { }
[void]EnterNestedPrompt(){ throw "Unsupported" }
[void]ExitNestedPrompt(){ throw "Unsupported" }
[void]NotifyBeginApplication() { }
[void]NotifyEndApplication() { }
[string]get_Name() { return $this.myName; write-host "MyName" }
[version]get_Version() { return $this.myVersion }
[System.Globalization.CultureInfo]get_CurrentCulture() { return $this.myCurrentCulture }
[System.Globalization.CultureInfo]get_CurrentUICulture() { return $this.myCurrentUICulture }
[System.Management.Automation.Host.PSHostUserInterface]get_UI() { return $this.myUI }
[guid]get_InstanceId() { return $this.myInstanceId }
TestHost() {
}
TestHost([bool]$isInteractive) {
$this.IsInteractive = $isInteractive
}
}
$q = [TestHost]::New()
$q | fl # has Name: MyHost entry
$q.Name # doesn't output anything
Expected: $q.Name and Name in ($q | fl) has the same value
Expected: $q.Name and Name in ($q | fl) has the same value