feat(invokeCommand.mock): Add invoke tracing#44
Conversation
|
|
||
| function Test_TraceInvokeCOmmandAlias{ | ||
|
|
||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| $fileName = "traceInvoke.log" | ||
| Assert-ItemNotExist -Path $fileName | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| $fileName = "traceInvoke.log" | ||
| Assert-ItemNotExist -Path $fileName | ||
|
|
||
| # Set flag |
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| $fileNamePath = $fileName | Resolve-Path | ||
| $env:TraceInvokeMockFilePath = $fileNamePath | ||
| Assert-ItemExist -Path $fileNamePath | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| # Act record invoke alias | ||
| Set-InvokeCommandMock -alias "fakeAlias1" -Command 'echo "hello from fakeAlias1"' | ||
| Set-InvokeCommandMock -alias "fakeAlias2" -Command 'echo "hello from fakeAlias2"' | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| Assert-Count -Expected 2 -Presented $content | ||
| Assert-Contains -Presented $content -Expected 'fakeAlias1' | ||
| Assert-Contains -Presented $content -Expected 'fakeAlias2' | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| Set-InvokeCommandMock -alias "fakeAlias1" -Command 'echo "hello from fakeAlias1"' | ||
| $content = Get-Content $fileNamePath | ||
| Assert-Count -Expected 2 -Presented $content | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
Allowm tracing all the mock invokes during test.
This will allow to know the dependecies the test has
This will allow to refresh mock data from live environment