1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["1416"],{1045(e,n,i){i.r(n),i.d(n,{metadata:()=>t,default:()=>h,frontMatter:()=>o,contentTitle:()=>a,toc:()=>c,assets:()=>l});var t=JSON.parse('{"id":"commands/Assert-VerifiableMock","title":"Assert-VerifiableMock","description":"Help for Pester command \'Assert-VerifiableMock\'. Checks if any Verifiable Mock has not been invoked. If so, this will throw an exception.","source":"@site/versioned_docs/version-v4/commands/Assert-VerifiableMock.mdx","sourceDirName":"commands","slug":"/commands/Assert-VerifiableMock","permalink":"/docs/v4/commands/Assert-VerifiableMock","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"v4","frontMatter":{"id":"Assert-VerifiableMock","title":"Assert-VerifiableMock","description":"Help for Pester command \'Assert-VerifiableMock\'. Checks if any Verifiable Mock has not been invoked. If so, this will throw an exception.","keywords":["PowerShell","Pester","Help","Documentation"],"hide_title":false,"hide_table_of_contents":false,"custom_edit_url":null},"sidebar":"commands","previous":{"title":"Assert-MockCalled","permalink":"/docs/v4/commands/Assert-MockCalled"},"next":{"title":"Assert-VerifiableMocks","permalink":"/docs/v4/commands/Assert-VerifiableMocks"}}'),s=i(1987),r=i(7008);let o={id:"Assert-VerifiableMock",title:"Assert-VerifiableMock",description:"Help for Pester command 'Assert-VerifiableMock'. Checks if any Verifiable Mock has not been invoked. If so, this will throw an exception.",keywords:["PowerShell","Pester","Help","Documentation"],hide_title:!1,hide_table_of_contents:!1,custom_edit_url:null},a,l={},c=[{value:"SYNOPSIS",id:"synopsis",level:2},{value:"SYNTAX",id:"syntax",level:2},{value:"DESCRIPTION",id:"description",level:2},{value:"EXAMPLES",id:"examples",level:2},{value:"EXAMPLE 1",id:"example-1",level:3},{value:"EXAMPLE 2",id:"example-2",level:3},{value:"PARAMETERS",id:"parameters",level:2},{value:"CommonParameters",id:"commonparameters",level:3},{value:"INPUTS",id:"inputs",level:2},{value:"OUTPUTS",id:"outputs",level:2},{value:"NOTES",id:"notes",level:2},{value:"RELATED LINKS",id:"related-links",level:2},{value:"VERSION",id:"version",level:2}];function d(e){let n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.admonition,{title:"This page was generated",type:"info",children:(0,s.jsxs)(n.p,{children:["Contributions are welcome in ",(0,s.jsx)(n.a,{href:"https://github.com/pester/Pester/tree/rel/4.x.x",children:"Pester v4-repo"}),"."]})}),"\n",(0,s.jsx)(n.h2,{id:"synopsis",children:"SYNOPSIS"}),"\n",(0,s.jsx)(n.p,{children:"Checks if any Verifiable Mock has not been invoked. If so, this will throw an exception."}),"\n",(0,s.jsx)(n.h2,{id:"syntax",children:"SYNTAX"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-powershell",children:"Assert-VerifiableMock\n"})}),"\n",(0,s.jsx)(n.h2,{id:"description",children:"DESCRIPTION"}),"\n",(0,s.jsx)(n.p,{children:"This can be used in tandem with the -Verifiable switch of the Mock\nfunction.\nMock can be used to mock the behavior of an existing command\nand optionally take a -Verifiable switch.\nWhen Assert-VerifiableMock\nis called, it checks to see if any Mock marked Verifiable has not been\ninvoked.\nIf any mocks have been found that specified -Verifiable and\nhave not been invoked, an exception will be thrown."}),"\n",(0,s.jsx)(n.h2,{id:"examples",children:"EXAMPLES"}),"\n",(0,s.jsx)(n.h3,{id:"example-1",children:"EXAMPLE 1"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-powershell",children:'Mock Set-Content {} -Verifiable -ParameterFilter {$Path -eq "some_path" -and $Value -eq "Expected Value"}\n\n{ ...some code that never calls Set-Content some_path -Value "Expected Value"...\n}\n\nAssert-VerifiableMock\n'})}),"\n",(0,s.jsx)(n.p,{children:"This will throw an exception and cause the test to fail."}),"\n",(0,s.jsx)(n.h3,{id:"example-2",children:"EXAMPLE 2"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-powershell",children:'Mock Set-Content {} -Verifiable -ParameterFilter {$Path -eq "some_path" -and $Value -eq "Expected Value"}\n\nSet-Content some_path -Value "Expected Value"\n\nAssert-VerifiableMock\n'})}),"\n",(0,s.jsx)(n.p,{children:"This will not throw an exception because the mock was invoked."}),"\n",(0,s.jsx)(n.h2,{id:"parameters",children:"PARAMETERS"}),"\n",(0,s.jsx)(n.h3,{id:"commonparameters",children:"CommonParameters"}),"\n",(0,s.jsxs)(n.p,{children:["This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,\n-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,\n-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see\n",(0,s.jsx)(n.a,{href:"https://go.microsoft.com/fwlink/?LinkID=113216",children:"about_CommonParameters"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"inputs",children:"INPUTS"}),"\n",(0,s.jsx)(n.h2,{id:"outputs",children:"OUTPUTS"}),"\n",(0,s.jsx)(n.h2,{id:"notes",children:"NOTES"}),"\n",(0,s.jsx)(n.h2,{id:"related-links",children:"RELATED LINKS"}),"\n",(0,s.jsx)(n.h2,{id:"version",children:"VERSION"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.em,{children:["This page was generated using comment-based help in ",(0,s.jsx)(n.a,{href:"https://github.com/pester/Pester/tree/rel/4.x.x",children:"Pester 4.10.1"}),"."]})})]})}function h(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},7008(e,n,i){i.d(n,{R:()=>o,x:()=>a});var t=i(1763);let s={},r=t.createContext(s);function o(e){let n=t.useContext(r);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.