diff --git a/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ModelStateDictionary.cs b/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ModelStateDictionary.cs
index e604b9d634..d2c6f3891c 100644
--- a/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ModelStateDictionary.cs
+++ b/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ModelStateDictionary.cs
@@ -385,26 +385,22 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public void SetModelValue([NotNull] string key, ValueProviderResult valueProviderResult)
{
- // Avoid creating a new array for rawvalue if there's only one value.
+ // Avoid creating a new array for rawValue if there's only one value.
object rawValue;
if (valueProviderResult == ValueProviderResult.None)
{
rawValue = null;
}
- else if (valueProviderResult.Value != null)
- {
- rawValue = valueProviderResult.Value;
- }
else if (valueProviderResult.Length == 1)
{
rawValue = valueProviderResult.Values[0];
}
else
{
- rawValue = valueProviderResult.Values;
+ rawValue = valueProviderResult.Values.ToArray();
}
- SetModelValue(key, rawValue, (string)valueProviderResult);
+ SetModelValue(key, rawValue, valueProviderResult.ToString());
}
///
diff --git a/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ValueProviderResult.cs b/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ValueProviderResult.cs
index 0c3fcfe2b3..4392822f3d 100644
--- a/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ValueProviderResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Abstractions/ModelBinding/ValueProviderResult.cs
@@ -4,9 +4,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Globalization;
-using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
@@ -38,9 +37,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
/// Creates a new using .
///
- /// The submitted value.
- public ValueProviderResult(string value)
- : this(value, _invariantCulture)
+ /// The submitted values.
+ public ValueProviderResult(StringValues values)
+ : this(values, _invariantCulture)
{
}
@@ -49,88 +48,36 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
/// The submitted value.
/// The associated with this value.
- public ValueProviderResult(string value, CultureInfo culture)
+ public ValueProviderResult(StringValues values, CultureInfo culture)
{
- if (value == null)
- {
- Value = null;
- Values = None.Values;
- }
- else
- {
- Value = value;
- Values = null;
- }
-
+ Values = values;
Culture = culture ?? _invariantCulture;
}
- ///
- /// Creates a new using .
- ///
- /// The submitted values.
- public ValueProviderResult(string[] values)
- : this(values, _invariantCulture)
- {
- }
-
- ///
- /// Creates a new .
- ///
- /// The submitted values.
- /// The associated with these values.
- public ValueProviderResult(string[] values, CultureInfo culture)
- {
- if (values == null)
- {
- Value = null;
- Values = None.Values;
- }
- else
- {
- Value = null;
- Values = values;
- }
-
- Culture = culture;
- }
-
///
/// Gets or sets the associated with the values.
///
public CultureInfo Culture { get; private set; }
///
- /// Gets or sets a single value. Will be null if multiple values are present.
+ /// Gets or sets the values.
///
- public string Value { get; private set; }
-
- ///
- /// Gets or sets an array of values. Will be null if only a single value was provided.
- ///
- public string[] Values { get; private set; }
+ public StringValues Values { get; private set; }
///
/// Gets the first value based on the order values were provided in the request. Use
- /// to get a single value for processing regarless of whether a single or multiple values were provided
+ /// to get a single value for processing regardless of whether a single or multiple values were provided
/// in the request.
///
public string FirstValue
{
get
{
- if (Value != null)
- {
- return Value;
- }
- else if (Values != null && Values.Length > 0)
- {
- return Values[0];
- }
- else
+ if (Values.Count == 0)
{
return null;
}
+ return Values[0];
}
}
@@ -141,18 +88,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
get
{
- if (Values != null)
- {
- return Values.Length;
- }
- else if (Value != null)
- {
- return 1;
- }
- else
- {
- return 0;
- }
+ return Values.Count;
}
}
@@ -172,9 +108,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
}
else
{
- var x = (string[])this;
- var y = (string[])other;
- for (var i = 0; i < x.Length; i++)
+ var x = Values;
+ var y = other.Values;
+ for (var i = 0; i < x.Count; i++)
{
if (!string.Equals(x[i], y[i], StringComparison.Ordinal))
{
@@ -188,28 +124,22 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public override int GetHashCode()
{
- return ((string)this)?.GetHashCode() ?? 0;
+ return ToString().GetHashCode();
}
///
public override string ToString()
{
- return (string)this;
+ return Values.ToString();
}
///
- /// Gets an for this .
+ /// Gets an for this .
///
- /// An .
- public Enumerator GetEnumerator()
+ /// An .
+ public IEnumerator GetEnumerator()
{
- return new Enumerator(this);
- }
-
- ///
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
+ return ((IEnumerable)Values).GetEnumerator();
}
///
@@ -225,22 +155,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
/// The .
public static explicit operator string(ValueProviderResult result)
{
- if (result.Values == null)
- {
- return result.Value;
- }
- else if (result.Values.Length == 0)
- {
- return null;
- }
- else if (result.Values.Length == 1)
- {
- return result.Values[0];
- }
- else
- {
- return string.Join(",", result.Values);
- }
+ return result.Values;
}
///
@@ -250,18 +165,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
/// The .
public static explicit operator string[](ValueProviderResult result)
{
- if (result.Values != null)
- {
- return result.Values;
- }
- else if (result.Value != null)
- {
- return new string[] { result.Value };
- }
- else
- {
- return None.Values;
- }
+ return result.Values;
}
///
@@ -285,71 +189,5 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
return !x.Equals(y);
}
-
- ///
- /// An enumerator for .
- ///
- public struct Enumerator : IEnumerator
- {
- private readonly ValueProviderResult _result;
- private readonly int _length;
- private int _index;
-
- ///
- /// Creates a new .
- ///
- /// The .
- public Enumerator(ValueProviderResult result)
- {
- _result = result;
- _index = -1;
- _length = result.Length;
- Current = null;
- }
-
- ///
- public string Current { get; private set; }
-
- ///
- object IEnumerator.Current => Current;
-
- ///
- public void Dispose()
- {
- }
-
- ///
- public bool MoveNext()
- {
- ++_index;
- if (_index < _length)
- {
- if (_result.Values != null)
- {
- Debug.Assert(_index < _result.Values.Length);
- Current = _result.Values[_index];
- return true;
- }
- else if (_result.Value != null && _index == 0)
- {
- Current = _result.Value;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- Current = null;
- return false;
- }
-
- ///
- public void Reset()
- {
- _index = -1;
- }
- }
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/CreatedAtActionResult.cs b/src/Microsoft.AspNet.Mvc.Core/CreatedAtActionResult.cs
index 2e1c5c7aba..709d6b2558 100644
--- a/src/Microsoft.AspNet.Mvc.Core/CreatedAtActionResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/CreatedAtActionResult.cs
@@ -7,6 +7,7 @@ using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Internal;
+using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNet.Mvc
{
@@ -73,7 +74,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(Resources.NoRoutesMatched);
}
- context.HttpContext.Response.Headers.Set("Location", url);
+ context.HttpContext.Response.Headers[HeaderNames.Location] = url;
}
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Mvc.Core/CreatedAtRouteResult.cs b/src/Microsoft.AspNet.Mvc.Core/CreatedAtRouteResult.cs
index 1767fed7bf..5131136bf1 100644
--- a/src/Microsoft.AspNet.Mvc.Core/CreatedAtRouteResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/CreatedAtRouteResult.cs
@@ -7,6 +7,7 @@ using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Internal;
+using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNet.Mvc
{
@@ -70,7 +71,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(Resources.NoRoutesMatched);
}
- context.HttpContext.Response.Headers.Set("Location", url);
+ context.HttpContext.Response.Headers[HeaderNames.Location] = url;
}
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Mvc.Core/CreatedResult.cs b/src/Microsoft.AspNet.Mvc.Core/CreatedResult.cs
index 31801556ed..af7148657f 100644
--- a/src/Microsoft.AspNet.Mvc.Core/CreatedResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/CreatedResult.cs
@@ -4,6 +4,7 @@
using System;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
+using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNet.Mvc
{
@@ -50,7 +51,7 @@ namespace Microsoft.AspNet.Mvc
///
protected override void OnFormatting([NotNull] ActionContext context)
{
- context.HttpContext.Response.Headers.Set("Location", Location);
+ context.HttpContext.Response.Headers[HeaderNames.Location] = Location;
}
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Mvc.Core/FileResult.cs b/src/Microsoft.AspNet.Mvc.Core/FileResult.cs
index 814be3e544..d33ce318c4 100644
--- a/src/Microsoft.AspNet.Mvc.Core/FileResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/FileResult.cs
@@ -68,7 +68,7 @@ namespace Microsoft.AspNet.Mvc
// basis for the actual filename, where possible.
var cd = new ContentDispositionHeaderValue("attachment");
cd.SetHttpFileName(FileDownloadName);
- context.HttpContext.Response.Headers.Set(HeaderNames.ContentDisposition, cd.ToString());
+ context.HttpContext.Response.Headers[HeaderNames.ContentDisposition] = cd.ToString();
}
// We aren't flowing the cancellation token appropriately, see
diff --git a/src/Microsoft.AspNet.Mvc.Core/HttpMethodConstraint.cs b/src/Microsoft.AspNet.Mvc.Core/HttpMethodConstraint.cs
index edabe282c8..9578de7981 100644
--- a/src/Microsoft.AspNet.Mvc.Core/HttpMethodConstraint.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/HttpMethodConstraint.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc
{
@@ -62,12 +63,12 @@ namespace Microsoft.AspNet.Mvc
if (request.Headers.ContainsKey(OriginHeader))
{
// Update the http method if it is preflight request.
- var accessControlRequestMethod = request.Headers.Get(AccessControlRequestMethod);
+ var accessControlRequestMethod = request.Headers[AccessControlRequestMethod];
if (string.Equals(
request.Method,
PreflightHttpMethod,
StringComparison.Ordinal) &&
- accessControlRequestMethod != null)
+ !StringValues.IsNullOrEmpty(accessControlRequestMethod))
{
method = accessControlRequestMethod;
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormCollectionModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormCollectionModelBinder.cs
index 274a081df3..7135bd52d2 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormCollectionModelBinder.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormCollectionModelBinder.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
@@ -51,11 +52,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
private class EmptyFormCollection : IFormCollection
{
- public string this[string key]
+ public StringValues this[string key]
{
get
{
- return null;
+ return StringValues.Empty;
}
}
@@ -93,12 +94,12 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
return null;
}
- public IEnumerator> GetEnumerator()
+ public IEnumerator> GetEnumerator()
{
- return Enumerable.Empty>().GetEnumerator();
+ return Enumerable.Empty>().GetEnumerator();
}
- public IList GetValues(string key)
+ public IList GetValues(string key)
{
return null;
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs
index a7b5cbb1a9..addca0ccda 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs
@@ -2,11 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
-using System.Linq;
#if DNXCORE50
using System.Reflection;
#endif
using System.Threading.Tasks;
+using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding
@@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
object model = null;
if (bindingContext.ModelType == typeof(string))
{
- var value = request.Headers.Get(headerName);
+ string value = request.Headers[headerName];
if (value != null)
{
model = value;
@@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
else if (typeof(IEnumerable).IsAssignableFrom(bindingContext.ModelType))
{
var values = request.Headers.GetCommaSeparatedValues(headerName);
- if (values != null)
+ if (values.Length > 0)
{
model = ModelBindingHelper.ConvertValuesToCollectionType(
bindingContext.ModelType,
@@ -60,11 +60,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
bindingContext.ModelName,
bindingContext.ModelMetadata,
model);
-
+
bindingContext.ModelState.SetModelValue(
- bindingContext.ModelName,
- request.Headers.GetCommaSeparatedValues(headerName).ToArray(),
- request.Headers.Get(headerName));
+ bindingContext.ModelName,
+ request.Headers.GetCommaSeparatedValues(headerName),
+ request.Headers[headerName]);
}
return Task.FromResult(
diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProvider.cs
index d72fbaa0e2..264011c196 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProvider.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProvider.cs
@@ -1,11 +1,12 @@
// Copyright (c) .NET Foundation. 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 System.Diagnostics;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
@@ -14,8 +15,8 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public class JQueryFormValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
{
+ private readonly IDictionary _values;
private PrefixContainer _prefixContainer;
- private readonly IDictionary _values;
///
/// Initializes a new instance of the class.
@@ -25,7 +26,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
/// The culture to return with ValueProviderResult instances.
public JQueryFormValueProvider(
[NotNull] BindingSource bindingSource,
- [NotNull] IDictionary values,
+ [NotNull] IDictionary values,
CultureInfo culture)
: base(bindingSource)
{
@@ -64,8 +65,8 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public override ValueProviderResult GetValue(string key)
{
- string[] values;
- if (_values.TryGetValue(key, out values) && values != null && values.Length > 0)
+ StringValues values;
+ if (_values.TryGetValue(key, out values) && values.Count > 0)
{
return new ValueProviderResult(values, Culture);
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProviderFactory.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProviderFactory.cs
index c1d289cb62..c416364a48 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProviderFactory.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/JQueryFormValueProviderFactory.cs
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
@@ -29,11 +30,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
return null;
}
- private static async Task> GetValueCollectionAsync(HttpRequest request)
+ private static async Task> GetValueCollectionAsync(HttpRequest request)
{
var formCollection = await request.ReadFormAsync();
- var dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ var dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase);
foreach (var entry in formCollection)
{
var key = NormalizeJQueryToMvc(entry.Key);
diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs
index 305c053cf2..5bb47fa870 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs
@@ -1,12 +1,8 @@
// Copyright (c) .NET Foundation. 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 System.Diagnostics;
using System.Globalization;
-using System.Linq;
-using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
@@ -73,14 +69,14 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public override ValueProviderResult GetValue([NotNull] string key)
{
- var values = _values.GetValues(key);
- if (values == null)
+ var values = _values[key];
+ if (values.Count == 0)
{
return ValueProviderResult.None;
}
else
{
- return new ValueProviderResult(values.ToArray(), _culture);
+ return new ValueProviderResult(values, _culture);
}
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ValueProviderResultExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ValueProviderResultExtensions.cs
index 0cee5ab03b..a5dc10f3fc 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ValueProviderResultExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ValueProviderResultExtensions.cs
@@ -21,7 +21,15 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public static T ConvertTo(this ValueProviderResult result)
{
- var valueToConvert = (object)result.Values ?? (object)result.Value;
+ object valueToConvert = null;
+ if (result.Values.Count == 1)
+ {
+ valueToConvert = result.Values[0];
+ }
+ else if (result.Values.Count > 1)
+ {
+ valueToConvert = result.Values.ToArray();
+ }
return ModelBindingHelper.ConvertTo(valueToConvert, result.Culture);
}
@@ -35,7 +43,15 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
///
public static object ConvertTo(this ValueProviderResult result, [NotNull] Type type)
{
- var valueToConvert = (object)result.Values ?? (object)result.Value;
+ object valueToConvert = null;
+ if (result.Values.Count == 1)
+ {
+ valueToConvert = result.Values[0];
+ }
+ else if (result.Values.Count > 1)
+ {
+ valueToConvert = result.Values.ToArray();
+ }
return ModelBindingHelper.ConvertTo(valueToConvert, type, result.Culture);
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ResponseCacheFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ResponseCacheFilter.cs
index ebe249a72b..dd45ce54b0 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ResponseCacheFilter.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ResponseCacheFilter.cs
@@ -4,8 +4,10 @@
using System;
using System.Globalization;
using System.Linq;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.Framework.Internal;
+using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNet.Mvc
{
@@ -94,24 +96,24 @@ namespace Microsoft.AspNet.Mvc
var headers = context.HttpContext.Response.Headers;
// Clear all headers
- headers.Remove("Vary");
- headers.Remove("Cache-control");
- headers.Remove("Pragma");
+ headers.Remove(HeaderNames.Vary);
+ headers.Remove(HeaderNames.CacheControl);
+ headers.Remove(HeaderNames.Pragma);
if (!string.IsNullOrEmpty(VaryByHeader))
{
- headers.Set("Vary", VaryByHeader);
+ headers[HeaderNames.Vary] = VaryByHeader;
}
if (NoStore)
{
- headers.Set("Cache-control", "no-store");
+ headers[HeaderNames.CacheControl] = "no-store";
// Cache-control: no-store, no-cache is valid.
if (Location == ResponseCacheLocation.None)
{
- headers.Append("Cache-control", "no-cache");
- headers.Set("Pragma", "no-cache");
+ headers.AppendCommaSeparatedValues(HeaderNames.CacheControl, "no-cache");
+ headers[HeaderNames.Pragma] = "no-cache";
}
}
else
@@ -127,7 +129,7 @@ namespace Microsoft.AspNet.Mvc
break;
case ResponseCacheLocation.None:
cacheControlValue = "no-cache";
- headers.Set("Pragma", "no-cache");
+ headers[HeaderNames.Pragma] = "no-cache";
break;
}
@@ -140,7 +142,7 @@ namespace Microsoft.AspNet.Mvc
if (cacheControlValue != null)
{
- headers.Set("Cache-control", cacheControlValue);
+ headers[HeaderNames.CacheControl] = cacheControlValue;
}
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs
index bc07ef6373..65f3fb9720 100644
--- a/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs
+++ b/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Cors.Core;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc
{
@@ -20,7 +21,7 @@ namespace Microsoft.AspNet.Mvc
private ICorsPolicyProvider _corsPolicyProvider;
///
- /// Creates a new instace of .
+ /// Creates a new instance of .
///
/// The .
/// The .
@@ -63,12 +64,12 @@ namespace Microsoft.AspNet.Mvc
_corsService.ApplyResult(result, context.HttpContext.Response);
var accessControlRequestMethod =
- httpContext.Request.Headers.Get(CorsConstants.AccessControlRequestMethod);
+ httpContext.Request.Headers[CorsConstants.AccessControlRequestMethod];
if (string.Equals(
request.Method,
CorsConstants.PreflightHttpMethod,
StringComparison.Ordinal) &&
- accessControlRequestMethod != null)
+ !StringValues.IsNullOrEmpty(accessControlRequestMethod))
{
// If this was a preflight, there is no need to run anything else.
// Also the response is always 200 so that anyone after mvc can handle the pre flight request.
diff --git a/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs
index 4885d622f5..90b25b4057 100644
--- a/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs
+++ b/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Cors.Core;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc
{
@@ -27,12 +28,12 @@ namespace Microsoft.AspNet.Mvc
public Task OnAuthorizationAsync([NotNull] AuthorizationContext context)
{
var accessControlRequestMethod =
- context.HttpContext.Request.Headers.Get(CorsConstants.AccessControlRequestMethod);
+ context.HttpContext.Request.Headers[CorsConstants.AccessControlRequestMethod];
if (string.Equals(
context.HttpContext.Request.Method,
CorsConstants.PreflightHttpMethod,
StringComparison.Ordinal) &&
- accessControlRequestMethod != null)
+ !StringValues.IsNullOrEmpty(accessControlRequestMethod))
{
// Short circuit if the request is preflight as that should not result in action execution.
context.Result = new HttpStatusCodeResult(StatusCodes.Status200OK);
diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs
index ce6f977a51..161207ff5c 100644
--- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs
+++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs
@@ -5,6 +5,7 @@ using System;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.Net.Http.Headers;
@@ -53,7 +54,7 @@ namespace Microsoft.AspNet.Mvc.WebApiCompatShim
foreach (var header in responseHeaders)
{
- response.Headers.AppendValues(header.Key, header.Value.ToArray());
+ response.Headers.Append(header.Key, header.Value.ToArray());
}
if (responseMessage.Content != null)
@@ -67,7 +68,7 @@ namespace Microsoft.AspNet.Mvc.WebApiCompatShim
foreach (var header in contentHeaders)
{
- response.Headers.AppendValues(header.Key, header.Value.ToArray());
+ response.Headers.Append(header.Key, header.Value.ToArray());
}
await responseMessage.Content.CopyToAsync(response.Body);
diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs
index a0c2ae056b..0af8ba7221 100644
--- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs
+++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageFeature.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Microsoft.AspNet.Http;
@@ -58,9 +59,9 @@ namespace Microsoft.AspNet.Mvc.WebApiCompatShim
{
// Every header should be able to fit into one of the two header collections.
// Try message.Headers first since that accepts more of them.
- if (!message.Headers.TryAddWithoutValidation(header.Key, header.Value))
+ if (!message.Headers.TryAddWithoutValidation(header.Key, (IEnumerable)header.Value))
{
- var added = message.Content.Headers.TryAddWithoutValidation(header.Key, header.Value);
+ var added = message.Content.Headers.TryAddWithoutValidation(header.Key, (IEnumerable)header.Value);
Debug.Assert(added);
}
}
diff --git a/test/Microsoft.AspNet.Mvc.Abstractions.Test/ModelBinding/ValueProviderResultTest.cs b/test/Microsoft.AspNet.Mvc.Abstractions.Test/ModelBinding/ValueProviderResultTest.cs
index ea875a1ad1..062f296a19 100644
--- a/test/Microsoft.AspNet.Mvc.Abstractions.Test/ModelBinding/ValueProviderResultTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Abstractions.Test/ModelBinding/ValueProviderResultTest.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using Microsoft.Framework.Primitives;
using Xunit;
namespace Microsoft.AspNet.Mvc.ModelBinding
@@ -15,12 +16,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
// Assert
Assert.Equal(0, result.Length);
- Assert.Null(result.Value);
Assert.Empty(result.Values);
Assert.Null(result.FirstValue);
Assert.Equal(ValueProviderResult.None, result);
Assert.Null((string)result);
- Assert.Empty((string[])result);
+ Assert.Null((string[])result);
}
[Fact]
@@ -31,12 +31,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
// Assert
Assert.Equal(0, result.Length);
- Assert.Null(result.Value);
Assert.Empty(result.Values);
Assert.Null(result.FirstValue);
Assert.Equal(ValueProviderResult.None, result);
Assert.Null((string)result);
- Assert.Empty((string[])result);
+ Assert.Null((string[])result);
}
[Fact]
@@ -47,10 +46,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
// Assert
Assert.Equal(0, result.Length);
- Assert.Null(result.Value);
Assert.Empty(result.Values);
Assert.Null(result.FirstValue);
Assert.Equal(ValueProviderResult.None, result);
+ Assert.Equal(ValueProviderResult.None, new ValueProviderResult(new StringValues()));
Assert.Null((string)result);
Assert.Empty((string[])result);
}
@@ -63,8 +62,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
// Assert
Assert.Equal(1, result.Length);
- Assert.Equal("Hi There", result.Value);
- Assert.Null(result.Values);
+ Assert.Equal("Hi There", result.Values);
Assert.Equal("Hi There", result.FirstValue);
Assert.NotEqual(ValueProviderResult.None, result);
Assert.Equal("Hi There", (string)result);
@@ -79,7 +77,6 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
// Assert
Assert.Equal(2, result.Length);
- Assert.Null(result.Value);
Assert.Equal(new string[] { "Hi", "There" }, result.Values);
Assert.Equal("Hi", result.FirstValue);
Assert.NotEqual(ValueProviderResult.None, result);
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/CreatedAtActionResultTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/CreatedAtActionResultTests.cs
index 5d2da109ac..4c3736a536 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/CreatedAtActionResultTests.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/CreatedAtActionResultTests.cs
@@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Mvc
var httpResponse = new Mock();
httpResponse.SetupProperty(o => o.StatusCode);
httpResponse.Setup(o => o.Headers).Returns(
- new HeaderDictionary(new Dictionary()));
+ new HeaderDictionary());
httpResponse.SetupGet(o => o.Body).Returns(stream);
return httpResponse.Object;
}
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/CreatedResultTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/CreatedResultTests.cs
index 7b556a8838..49d31674eb 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/CreatedResultTests.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/CreatedResultTests.cs
@@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Mvc
var location = "/test/";
var httpContext = GetHttpContext();
var actionContext = GetActionContext(httpContext);
- httpContext.Response.Headers.Set("Location", "/different/location/");
+ httpContext.Response.Headers["Location"] = "/different/location/";
var result = new CreatedResult(location, "testInput");
// Act
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/FormatFilterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/FormatFilterTest.cs
index 5f855d6c3a..0ade1df1b3 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/FormatFilterTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/FormatFilterTest.cs
@@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Mvc
// Query contains xml
httpContext.Setup(c => c.Request.Query.ContainsKey("format")).Returns(true);
- httpContext.Setup(c => c.Request.Query.Get("format")).Returns("xml");
+ httpContext.Setup(c => c.Request.Query["format"]).Returns("xml");
// Routedata contains json
var data = new RouteData();
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs
index 6a0896429c..6af1e67834 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeValueProviderTest.cs
@@ -8,6 +8,7 @@ using System.Collections.Generic;
using System.Globalization;
#if DNX451
using System.Threading.Tasks;
+using Microsoft.Framework.Primitives;
using Moq;
using Xunit;
#endif
@@ -18,11 +19,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
protected override IEnumerableValueProvider GetEnumerableValueProvider(
BindingSource bindingSource,
- IDictionary values,
+ IDictionary values,
CultureInfo culture)
{
var emptyValueProvider =
- new JQueryFormValueProvider(bindingSource, new Dictionary(), culture);
+ new JQueryFormValueProvider(bindingSource, new Dictionary(), culture);
var valueProvider = new JQueryFormValueProvider(bindingSource, values, culture);
return new CompositeValueProvider(new[] { emptyValueProvider, valueProvider });
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryModelBinderTest.cs
index 15f71c2eb9..14afbb6e9f 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryModelBinderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryModelBinderTest.cs
@@ -8,6 +8,7 @@ using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Http.Internal;
+using Microsoft.Framework.Primitives;
using Moq;
using Xunit;
@@ -453,10 +454,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Test
string keyFormat,
IDictionary dictionary)
{
- // Convert to an IDictionary then wrap it up.
+ // Convert to an IDictionary then wrap it up.
var backingStore = dictionary.ToDictionary(
kvp => string.Format(keyFormat, kvp.Key),
- kvp => new[] { kvp.Value });
+ kvp => (StringValues)kvp.Value);
var stringCollection = new ReadableStringCollection(backingStore);
return new ReadableStringCollectionValueProvider(
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs
index 9eef0f2438..118a4d71a3 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/EnumerableValueProviderTest.cs
@@ -5,34 +5,35 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.Framework.Primitives;
using Xunit;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
public abstract class EnumerableValueProviderTest
{
- private static readonly IDictionary _backingStore = new Dictionary
+ private static readonly IDictionary _backingStore = new Dictionary
{
{ "some", new[] { "someValue1", "someValue2" } },
- { "null_value", null },
+ { "null_value", StringValues.Empty },
{ "prefix.name", new[] { "someOtherValue" } },
- { "prefix.null_value", null },
- { "prefix.property1.property", null },
- { "prefix.property2[index]", null },
- { "prefix[index1]", null },
- { "prefix[index1].property1", null },
- { "prefix[index1].property2", null },
- { "prefix[index2].property", null },
- { "[index]", null },
- { "[index].property", null },
- { "[index][anotherIndex]", null },
+ { "prefix.null_value", StringValues.Empty },
+ { "prefix.property1.property", StringValues.Empty },
+ { "prefix.property2[index]", StringValues.Empty },
+ { "prefix[index1]", StringValues.Empty },
+ { "prefix[index1].property1", StringValues.Empty },
+ { "prefix[index1].property2", StringValues.Empty },
+ { "prefix[index2].property", StringValues.Empty },
+ { "[index]", StringValues.Empty },
+ { "[index].property", StringValues.Empty },
+ { "[index][anotherIndex]", StringValues.Empty },
};
[Fact]
public void ContainsPrefix_WithEmptyCollection_ReturnsFalseForEmptyPrefix()
{
// Arrange
- var backingStore = new Dictionary();
+ var backingStore = new Dictionary();
var valueProvider = GetEnumerableValueProvider(BindingSource.Query, backingStore, culture: null);
// Act
@@ -209,7 +210,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
public void GetValue_NullMultipleValue()
{
// Arrange
- var backingStore = new Dictionary
+ var backingStore = new Dictionary
{
{ "key", new string[] { null, null, "value" } },
};
@@ -278,7 +279,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
private IBindingSourceValueProvider GetBindingSourceValueProvider(
BindingSource bindingSource,
- IDictionary values,
+ IDictionary values,
CultureInfo culture)
{
var provider = GetEnumerableValueProvider(bindingSource, values, culture) as IBindingSourceValueProvider;
@@ -291,7 +292,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
protected abstract IEnumerableValueProvider GetEnumerableValueProvider(
BindingSource bindingSource,
- IDictionary values,
+ IDictionary values,
CultureInfo culture);
}
}
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormCollectionModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormCollectionModelBinderTest.cs
index b7ec8e7a30..bae7867255 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormCollectionModelBinderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormCollectionModelBinderTest.cs
@@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Internal;
+using Microsoft.Framework.Primitives;
using Moq;
using Xunit;
@@ -20,10 +21,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
public async Task FormCollectionModelBinder_ValidType_BindSuccessful()
{
// Arrange
- var formCollection = new FormCollection(new Dictionary
+ var formCollection = new FormCollection(new Dictionary
{
- { "field1", new string[] { "value1" } },
- { "field2", new string[] { "value2" } }
+ { "field1", "value1" },
+ { "field2", "value2" }
});
var httpContext = GetMockHttpContext(formCollection);
var bindingContext = GetBindingContext(typeof(IFormCollection), httpContext);
@@ -48,10 +49,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
public async Task FormCollectionModelBinder_InvalidType_BindFails()
{
// Arrange
- var formCollection = new FormCollection(new Dictionary
+ var formCollection = new FormCollection(new Dictionary
{
- { "field1", new string[] { "value1" } },
- { "field2", new string[] { "value2" } }
+ { "field1", "value1" },
+ { "field2", "value2" }
});
var httpContext = GetMockHttpContext(formCollection);
var bindingContext = GetBindingContext(typeof(string), httpContext);
@@ -69,9 +70,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
public async Task FormCollectionModelBinder_FormCollectionConcreteType_BindFails()
{
// Arrange
- var formCollection = new FormCollection(new Dictionary
+ var formCollection = new FormCollection(new Dictionary
{
- { "field1", new string[] { "value1" } },
+ { "field1", "value1" },
{ "field2", new string[] { "value2" } }
});
var httpContext = GetMockHttpContext(formCollection);
@@ -131,11 +132,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
private class MyFormCollection : ReadableStringCollection, IFormCollection
{
- public MyFormCollection(IDictionary store) : this(store, new FormFileCollection())
+ public MyFormCollection(IDictionary store) : this(store, new FormFileCollection())
{
}
- public MyFormCollection(IDictionary store, IFormFileCollection files) : base(store)
+ public MyFormCollection(IDictionary store, IFormFileCollection files) : base(store)
{
Files = files;
}
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormValueProviderFactoryTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormValueProviderFactoryTest.cs
index dffcf21cb4..73db5084ad 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormValueProviderFactoryTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormValueProviderFactoryTest.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNet.Http.Internal;
+using Microsoft.Framework.Primitives;
using Xunit;
namespace Microsoft.AspNet.Mvc.ModelBinding.Test
@@ -52,7 +53,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Test
if (context.Request.HasFormContentType)
{
- context.Request.Form = new FormCollection(new Dictionary());
+ context.Request.Form = new FormCollection(new Dictionary());
}
return new ValueProviderFactoryContext(
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderFactoryTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderFactoryTest.cs
index 76fdd6f600..c46be451cc 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderFactoryTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderFactoryTest.cs
@@ -6,13 +6,14 @@ using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNet.Http.Internal;
+using Microsoft.Framework.Primitives;
using Xunit;
namespace Microsoft.AspNet.Mvc.ModelBinding.Test
{
public class JQueryFormValueProviderFactoryTest
{
- private static readonly IDictionary _backingStore = new Dictionary
+ private static readonly IDictionary _backingStore = new Dictionary
{
{ "[]", new[] { "found" } },
{ "[]property1", new[] { "found" } },
@@ -115,14 +116,14 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Test
private static ValueProviderFactoryContext CreateContext(
string contentType,
- IDictionary formValues)
+ IDictionary formValues)
{
var context = new DefaultHttpContext();
context.Request.ContentType = contentType;
if (context.Request.HasFormContentType)
{
- context.Request.Form = new FormCollection(formValues ?? new Dictionary());
+ context.Request.Form = new FormCollection(formValues ?? new Dictionary());
}
return new ValueProviderFactoryContext(
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs
index 4fa1b91d66..bd31ea857e 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/JQueryFormValueProviderTest.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Globalization;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
@@ -10,7 +11,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
protected override IEnumerableValueProvider GetEnumerableValueProvider(
BindingSource bindingSource,
- IDictionary values,
+ IDictionary values,
CultureInfo culture)
{
return new JQueryFormValueProvider(bindingSource, values, culture);
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ReadableStringCollectionValueProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ReadableStringCollectionValueProviderTest.cs
index 9a3cd94490..a31e476a27 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ReadableStringCollectionValueProviderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ReadableStringCollectionValueProviderTest.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Globalization;
using Microsoft.AspNet.Http.Internal;
+using Microsoft.Framework.Primitives;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
@@ -11,7 +12,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
protected override IEnumerableValueProvider GetEnumerableValueProvider(
BindingSource bindingSource,
- IDictionary values,
+ IDictionary values,
CultureInfo culture)
{
var backingStore = new ReadableStringCollection(values);
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ResponseCacheFilterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ResponseCacheFilterTest.cs
index 347ada991b..6e758e98a4 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ResponseCacheFilterTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ResponseCacheFilterTest.cs
@@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc
cache.OnActionExecuting(context);
// Assert
- Assert.Equal("no-store", context.HttpContext.Response.Headers.Get("Cache-control"));
+ Assert.Equal("no-store", context.HttpContext.Response.Headers["Cache-control"]);
}
[Fact]
@@ -157,7 +157,7 @@ namespace Microsoft.AspNet.Mvc
cache.OnActionExecuting(context);
// Assert
- Assert.Equal(output, context.HttpContext.Response.Headers.Get("Cache-control"));
+ Assert.Equal(output, context.HttpContext.Response.Headers["Cache-control"]);
}
public static IEnumerable