It 'On Windows Server 2012R2 check fails when component is not installed' {
$mode = 'Check'
Mock Get-WindowsFeature {
param(
[string] $Name
)
[PSCustomObject]@{Installed = $false}
}
Manage-ActiveDirectoryModuleOnWindowsServer2012R2 | should Be $false
Assert-MockCalled Get-WindowsFeature -Scope It
}
--
You received this message because you are subscribed to the Google Groups "Pester" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pester+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
if (-not $commandInfo.Command) {
throw ([System.Management.Automation.CommandNotFoundException] "Could not find Command $commandName")
}
Get-Command : The term 'Get-WindowsFeature' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Get-WindowsFeature ServerMan...
001
002 003 004 005 006 007 008 009 010 011 012 013 014 |
BeforeEach { # Create a Dummy AD module and import it $DummyModule = New-Module -Name ServerManager -Function "Get-WindowsFeature" -ScriptBlock { Function Get-WindowsFeature {"Get-WindowsFeature"} ; } $DummyModule| Import-Module } AfterEach { # Forcefully remove the Dummy AD Module Remove-Module -Name ServerManager -Force -ErrorAction SilentlyContinue } |