Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
New-TemporaryFile.Tests.ps139 linesDownload Raw Back to Microsoft.PowerShell.Utility
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3 4# This is a Pester test suite to validate the New-TemporaryFile cmdlet in the Microsoft.PowerShell.Utility module.5 6<#7    Purpose:8        Verify that New-TemporaryFile creates a temporary file.9 10    Action:11        Run New-TemporaryFile.12 13    Expected Result:14        A FileInfo object for the temporary file is returned.15#>16 17Describe "New-TemporaryFile" -Tags "CI" {18 19    It "creates a new temporary file" {20        $tempFile = New-TemporaryFile21 22        $tempFile | Should -Exist23        $tempFile | Should -BeOfType System.IO.FileInfo24        $tempFile | Should -BeLikeExactly "$([System.IO.Path]::GetTempPath())*"25 26        if (Test-Path $tempFile) {27            Remove-Item $tempFile -ErrorAction SilentlyContinue -Force28        }29    }30 31    It "with WhatIf does not create a file" {32        New-TemporaryFile -WhatIf | Should -BeNullOrEmpty33    }34 35    It "has an OutputType of System.IO.FileInfo" {36        (Get-Command New-TemporaryFile).OutputType | Should -BeExactly "System.IO.FileInfo"37    }38}39