From 0fbd41ac0b1b8aae5238063f94e2f498ab777830 Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:23:38 -0500 Subject: [PATCH] AddActionMembers changed AddActionMembers to add ScriptMethod members; this is a breaking change --- lib/meta.ps1 | 10 +++------- tests/higher.Tests.ps1 | 14 +++++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/meta.ps1 b/lib/meta.ps1 index 5079672..a6b8144 100644 --- a/lib/meta.ps1 +++ b/lib/meta.ps1 @@ -66,14 +66,10 @@ function AddActionMembers () { param( [String[]]$PARAMS ) - [hashtable]$Signatures = @{} foreach ($param in $PARAMS) { - # Define getter - $Signatures['Getter'] = "`$this.Setter('{0}', `$true)" -f $param - # Define setter - $Signatures['Setter'] = '' - - Addmember + $this | Add-Member -MemberType ScriptMethod -Name $param ` + -Value ([scriptblock]::Create("`$null = `$this.Setter('$param', 1)")) ` + -Force } } diff --git a/tests/higher.Tests.ps1 b/tests/higher.Tests.ps1 index 4c94b5c..7e45b03 100644 --- a/tests/higher.Tests.ps1 +++ b/tests/higher.Tests.ps1 @@ -119,7 +119,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { Context 'Vban' { It 'Should set and get Vban.enable' { $vmr.vban.enable = $value - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.vban.enable | Should -Be $expected } @@ -214,14 +214,14 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { Context 'Option' { It 'Should set and get Option.monitoronsel' -Skip:$ifNotPotato { $vmr.option.monitoronsel = $value - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.option.monitoronsel | Should -Be $value } It 'Should set and get Option.slidermode' -Skip:$ifNotPotato { $vmr.option.slidermode = $value - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.option.slidermode | Should -Be $value } @@ -361,7 +361,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { @{ Value = 486.57 }, @{ Value = 26.41 } ) { $vmr.option.delay[$phys_out].set($value) - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.option.delay[$phys_out].get() | Should -Be $value } @@ -452,7 +452,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { @{ Value = 65535; Expected = 65535 } ) { $vmr.vban.port = $value - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.vban.port | Should -Be $expected } @@ -465,7 +465,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { @{ Value = 65535; Expected = 65535 } ) { $vmr.vban.instream[$index].port = $value - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.vban.instream[$index].port | Should -Be $expected } @@ -508,7 +508,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { @{ Value = 65535; Expected = 65535 } ) { $vmr.vban.outstream[$index].port = $value - $vmr.command.restart + $vmr.command.restart() Start-Sleep -Milliseconds 2000 $vmr.vban.outstream[$index].port | Should -Be $expected }