resource/dummy/test/private/Set-Dummy.Tests.ps1
Describe "Testing private module function Set-Dummy" -Tag "UnitTest" { Context "Generic Context" { BeforeAll { $ModuleRoot = $PSCommandPath | Split-Path -Parent | Split-Path -Parent | Split-Path -Parent $ScriptName = $PSCommandPath | Split-Path -Leaf $Visibility = $PSCommandPath | Split-Path -Parent | Split-Path -Leaf $SourceDirectory = Resolve-Path (Join-Path $ModuleRoot "source\$Visibility") #$TestDirectory = Resolve-Path (Join-Path $ModuleRoot "test\$Visibility") $FunctionPath = Join-Path $SourceDirectory ($ScriptName -replace '\.Tests\.ps1$', '.ps1') # Create a Stub to invoke the module function to test Function Set-Dummy { . $FunctionPath @args | write-Output } # Mocking dependencies of the function Function Write-Host { # This function is a stub and will be replaced in the tests by a Mock command } Mock Write-Host { # Just returns } } It "Set-Dummy should not throw" { { Set-Dummy } | Should -Not -Throw } It "Set-Dummy should return TRUE" { $Result = Set-Dummy $Result | Should -BeTrue } } } |