daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Get-Module Pester, A, B | Remove-Module
  2. Import-Module C:\Projects\Pester_main\Pester.psd1
  3.  
  4. New-Module A { } | Import-Module
  5. New-Module B {
  6.     function Greet ($Name) { Hello -Name $Name }
  7.     function Hello ($Name) { "Hello, $Name" }
  8.  
  9.     Export-ModuleMember -Function WrapWrapWrap, Greet
  10. } | Import-Module
  11.  
  12. Describe "I" {
  13.     Context "see" {
  14.         It "scopes" {
  15.  
  16.             Mock Hello -ModuleName B
  17.          
  18.             InModuleScope -ModuleName A {
  19.                 Greet -Name "Jakub"
  20.             }
  21.            
  22.             $jakub = "Jakub"
  23.             Assert-MockCalled Hello `
  24.                 -ModuleName B `
  25.                 -ParameterFilter { $Name -eq $jakub }
  26.         }
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top