#103 Fix ambigious Keys property on IHeaderDictionary.
This commit is contained in:
parent
8ab566e049
commit
dd7537de4a
|
|
@ -24,6 +24,12 @@ namespace Microsoft.AspNet.Http
|
||||||
/// </summary>
|
/// </summary>
|
||||||
new int Count { get; }
|
new int Count { get; }
|
||||||
|
|
||||||
|
// This property is duplicated to resolve an ambiguity between IReadableStringCollection.Keys and IDictionary<string, string[]>.Keys
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a collection containing the keys.
|
||||||
|
/// </summary>
|
||||||
|
new ICollection<string> Keys { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the associated values from the collection separated into individual values.
|
/// Get the associated values from the collection separated into individual values.
|
||||||
/// Quoted values will not be split, and the quotes will be removed.
|
/// Quoted values will not be split, and the quotes will be removed.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNet.PipelineCore.Collections;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
|
{
|
||||||
|
public class HeaderDictionaryTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void PropertiesAreAccessible()
|
||||||
|
{
|
||||||
|
var headers = new HeaderDictionary(
|
||||||
|
new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
{ "Header1", new[] { "Value1" } }
|
||||||
|
});
|
||||||
|
|
||||||
|
Assert.Equal(1, headers.Count);
|
||||||
|
Assert.Equal(new[] { "Headers1" }, headers.Keys);
|
||||||
|
Assert.True(headers.ContainsKey("headers1"));
|
||||||
|
Assert.False(headers.ContainsKey("headers2"));
|
||||||
|
Assert.Equal("Value1", headers["header1"]);
|
||||||
|
Assert.Equal("Value1", headers.Get("header1"));
|
||||||
|
Assert.Equal(new[] { "Value1" }, headers.GetValues("header1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,10 +23,11 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BuilderTests.cs" />
|
<Compile Include="BuilderTests.cs" />
|
||||||
<Compile Include="FormFeatureTests.cs" />
|
<Compile Include="FormFeatureTests.cs" />
|
||||||
|
<Compile Include="HeaderDictionaryTests.cs" />
|
||||||
<Compile Include="QueryFeatureTests.cs" />
|
<Compile Include="QueryFeatureTests.cs" />
|
||||||
<Compile Include="DefaultHttpContextTests.cs" />
|
<Compile Include="DefaultHttpContextTests.cs" />
|
||||||
<Compile Include="DefaultHttpRequestTests.cs" />
|
<Compile Include="DefaultHttpRequestTests.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
Reference in New Issue