Replies: 3 comments 5 replies
-
Hi. You can display If they should be equal, you can compare ex filenames using: $expected.Name | Sort-Object | Should -Be ($list.Name | Sort-Object)`
# sorting to avoid order-issue Tip: For a simple filename-filter I'd recommend For the future, it helps with a valid repro. This code won't run as-is due to wrong types in Mock (won't work with List.AddRange() |
Beta Was this translation helpful? Give feedback.
-
Thank you! |
Beta Was this translation helpful? Give feedback.
-
Is it possible to check the If I try
I got this error
Thank you so much in advance. |
Beta Was this translation helpful? Give feedback.
-
I want to create a PowerShell script that can delete a bunch of file in given paths following a particular match (in the following example all the files that contain TMP). This is the function:
Now, I want to create the test for this function. I mock the
Get-ChildItem
so I can verify what files the function has to return. I like to have all the details of the files (such as name, creation date and so on)The problems I'm facing are:
$list
to check the list of files$list
with$expected
Beta Was this translation helpful? Give feedback.
All reactions