This repository was archived by the owner on Aug 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ Describe ' Remove-RegistryValue' {
2+ BeforeAll {
3+ . $PSScriptRoot / ../ src/ remove-from - registry.ps1
4+
5+ Mock Write-Host {
6+ param ($Object )
7+ $global :actualParameters = $Object
8+ }
9+ }
10+
11+ BeforeEach {
12+ if (-Not (Test-Path - Path " TestRegistry:\TestLocation" ))
13+ {
14+ New-Item - Path TestRegistry:\ - Name TestLocation
15+ }
16+ New-ItemProperty - Path " TestRegistry:\TestLocation" - Name " TestKey" - Value " sample"
17+
18+ Test-Path - Path " TestRegistry:\TestLocation" | Should - Be $true
19+ $value = Get-ItemProperty - Path " TestRegistry:\TestLocation" - Name " TestKey" | Select-Object - ExpandProperty " TestKey"
20+ $value | Should - Be " sample"
21+ }
22+
23+ It ' Should delete registry key' {
24+ $result = Remove-RegistryValue - registryValue " TestRegistry:\TestLocation\TestKey"
25+ $result | Should - Be $true
26+
27+ Test-Path - Path " TestRegistry:\TestLocation" | Should - Be $true
28+ $result = $null -eq (Get-ItemProperty - Path " TestRegistry:\TestLocation" - Name " TestKey" - ErrorAction SilentlyContinue)
29+ $result | Should - Be $true
30+ Should - Invoke Write-Host - Exactly 1
31+ Should - Invoke Write-Host - Exactly 1 - ParameterFilter { $Object -eq " Removed: TestRegistry:\TestLocation\TestKey" }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments