Files
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-FormatData.Tests.ps1
T
Syed Faraaz Ahmad b754cd80d5 Throw error on entering non-existing type in Get-FormatData (#7434)
Write non-terminating error when `Get-FormatData` doesn't found a type definition for the provided type,
2018-08-10 09:34:02 +05:00

21 lines
683 B
PowerShell

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
Describe "Get-FormatData" -Tags "CI" {
Context "Check return type of Get-FormatData" {
It "Should return an object[] as the return type" {
$result = Get-FormatData
,$result | Should -BeOfType "System.Object[]"
}
}
Context "Check for error on invalid type as argument" {
It "Should throw error on invalid type as argument" {
{ Get-FormatData "NoSuch.Type.Exists.Or.IsLoaded" -ErrorAction Stop } | Should -Throw -ErrorId "SpecifiedTypeNotFound,Microsoft.PowerShell.Commands.GetFormatDataCommand"
}
}
}