Pester mock method for Powershell 5 class
问题 I am having an issue trying to mock a powershell 5 class method, when executing the test, I get the error " CommandNotFoundException: Could not find Command FunctionToMock". I am trying to unit test the "OutputToOverwrite" method by mocking "FunctionToMock". I think I would have to mock ChocoClass itself first, but I am not sure how to do it. Thanks. Class ChocoClass { [string] OutputToOverwrite() { return $this.FunctionToMock() } [string] FunctionToMock() { return "This text will be replaced