Skip to content

Commit 267f6e2

Browse files
author
Robert Holt
committed
Add test for case insensitive query dictionary assembly
1 parent 3b56bac commit 267f6e2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
Describe ".NET type with members with names differing only by name" {
5+
BeforeAll {
6+
Add-Type -TypeDefinition @'
7+
namespace PSScriptAnalyzerTests
8+
{
9+
public class QueryApiTestObject
10+
{
11+
public string JobId { get; set; }
12+
13+
public object JOBID { get; set; }
14+
}
15+
}
16+
'@
17+
}
18+
19+
It "Does not crash the query API" {
20+
$typeData = [Microsoft.PowerShell.CrossCompatibility.Utility.TypeDataConversion]::AssembleType([PSScriptAnalyzerTests.QueryApiTestObject])
21+
22+
$typeQueryObject = New-Object 'Microsoft.PowerShell.CrossCompatibility.Query.TypeData' ('QueryApiTestObject', $typeData)
23+
24+
$typeData.Instance.Properties.Count | Should -Be 1
25+
$typeData.Instance.Properties.Keys | Should -Contain 'jobid'
26+
}
27+
}

0 commit comments

Comments
 (0)