Skip to content

Commit be09670

Browse files
authored
Make the binding-info dictionary case-insensitive on the key (binding name) (#182)
1 parent fa3dd6e commit be09670

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/FunctionInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ internal AzFunctionInfo(RpcFunctionMetadata metadata)
6868
var parametersCopy = new Dictionary<string, PSScriptParamInfo>(psScriptParams, StringComparer.OrdinalIgnoreCase);
6969
parametersCopy.Remove(TriggerMetadata);
7070

71-
var allBindings = new Dictionary<string, ReadOnlyBindingInfo>();
72-
var inputBindings = new Dictionary<string, ReadOnlyBindingInfo>();
73-
var outputBindings = new Dictionary<string, ReadOnlyBindingInfo>();
71+
var allBindings = new Dictionary<string, ReadOnlyBindingInfo>(StringComparer.OrdinalIgnoreCase);
72+
var inputBindings = new Dictionary<string, ReadOnlyBindingInfo>(StringComparer.OrdinalIgnoreCase);
73+
var outputBindings = new Dictionary<string, ReadOnlyBindingInfo>(StringComparer.OrdinalIgnoreCase);
7474

7575
var inputsMissingFromParams = new List<string>();
7676
foreach (var binding in metadata.Bindings)

test/Unit/Modules/Microsoft.Azure.Functions.PowerShellWorker.Tests.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ namespace Microsoft.Azure.Functions.PowerShellWorker
131131
$result[$Key][1] | Should -BeExactly 2
132132
}
133133

134+
It 'Can add value with binding name that differs in case' {
135+
Push-OutputBinding -Name RESPONSE -Value 'UpperCase'
136+
Push-OutputBinding -Name QUeue -Value 'MixedCase'
137+
138+
$result = Get-OutputBinding -Purge
139+
if ($IsWindows) {
140+
$result["response"] | Should -BeExactly 'UpperCase'
141+
$result["queue"] | Should -BeExactly 'MixedCase'
142+
} else {
143+
# Hashtable on Ubuntu 18.04 server is case-sensitive.
144+
# It's fixed in 6.2, but the 'pwsh' used in AppVeyor is not 6.2
145+
$result["RESPONSE"] | Should -BeExactly 'UpperCase'
146+
$result["QUeue"] | Should -BeExactly 'MixedCase'
147+
}
148+
}
149+
134150
It 'Can add a value via pipeline' {
135151
'Baz' | Push-OutputBinding -Name response
136152
'item1', 'item2', 'item3' | Push-OutputBinding -Name queue

0 commit comments

Comments
 (0)