Skip to content

Make the binding-info dictionary case-insensitive on the key (binding name) #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/FunctionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ internal AzFunctionInfo(RpcFunctionMetadata metadata)
var parametersCopy = new Dictionary<string, PSScriptParamInfo>(psScriptParams, StringComparer.OrdinalIgnoreCase);
parametersCopy.Remove(TriggerMetadata);

var allBindings = new Dictionary<string, ReadOnlyBindingInfo>();
var inputBindings = new Dictionary<string, ReadOnlyBindingInfo>();
var outputBindings = new Dictionary<string, ReadOnlyBindingInfo>();
var allBindings = new Dictionary<string, ReadOnlyBindingInfo>(StringComparer.OrdinalIgnoreCase);
var inputBindings = new Dictionary<string, ReadOnlyBindingInfo>(StringComparer.OrdinalIgnoreCase);
var outputBindings = new Dictionary<string, ReadOnlyBindingInfo>(StringComparer.OrdinalIgnoreCase);

var inputsMissingFromParams = new List<string>();
foreach (var binding in metadata.Bindings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ namespace Microsoft.Azure.Functions.PowerShellWorker
$result[$Key][1] | Should -BeExactly 2
}

It 'Can add value with binding name that differs in case' {
Push-OutputBinding -Name RESPONSE -Value 'UpperCase'
Push-OutputBinding -Name QUeue -Value 'MixedCase'

$result = Get-OutputBinding -Purge
if ($IsWindows) {
$result["response"] | Should -BeExactly 'UpperCase'
$result["queue"] | Should -BeExactly 'MixedCase'
} else {
# Hashtable on Ubuntu 18.04 server is case-sensitive.
# It's fixed in 6.2, but the 'pwsh' used in AppVeyor is not 6.2
$result["RESPONSE"] | Should -BeExactly 'UpperCase'
$result["QUeue"] | Should -BeExactly 'MixedCase'
}
}

It 'Can add a value via pipeline' {
'Baz' | Push-OutputBinding -Name response
'item1', 'item2', 'item3' | Push-OutputBinding -Name queue
Expand Down