Your code is calling New-Item, which creates a new file. Ok, so you have added Save-Tomato() to your script file. Dot source the code to ensure it's being picked up:.Update the Get-Tomato.ps1 file with this code:.So, in this case, imagine that our production code now will have more function Save-Tomato that saves an object to a file. All you need to do is to focus that the right behavior happens. The short answer is that you can use mocks, a construct that's executed instead of the actual command. Let's look at such a case and how Pester handles it. You will have code that you write that eventually performs side effects, like accessing a network resource or create a file. Great, you ran a test on a more real looking code. Tests Passed: 1, Failed: 0, Skipped: 0 NotRun: 0
0 Comments
Leave a Reply. |