Samples/EventTest.ps1

function Create-FileWatcher
{
    param
    (
        [object]
        $Path
    )

    $properties = @{
        Path = $Path
        NotifyFilter = [IO.NotifyFilters]'FileName'
        IncludeSubdirectories = $False   
    }

    $eventObject = New-Object System.IO.FileSystemWatcher -Property $properties
  
    return $eventObject
}

$FileWatcherEvent = Create-FileWatcher C:\Users\rkozak\Desktop

Pipeline: FileWatcherTest {
        When: $FileWatcherEvent {
            Write-Output "test filewatcher event: $eventSubscriber"
        } -Wait -EventName Created -Timeout 1
} -Invoke -Verbose