Handle change to cookie parser.
This commit is contained in:
parent
062722f1fb
commit
7641ca3722
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNet.Http;
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Core;
|
using Microsoft.AspNet.Http.Core;
|
||||||
using Microsoft.AspNet.Http.Core.Collections;
|
using Microsoft.AspNet.Http.Core.Collections;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
@ -14,7 +15,7 @@ namespace MusicStore.Models
|
||||||
var cartId = "cartId_A";
|
var cartId = "cartId_A";
|
||||||
|
|
||||||
var httpContext = new DefaultHttpContext();
|
var httpContext = new DefaultHttpContext();
|
||||||
httpContext.SetFeature<IRequestCookiesFeature>(new CookiesFeature("Session=" + cartId));
|
httpContext.SetFeature<IRequestCookiesFeature>(new CookiesFeature("Session", cartId));
|
||||||
|
|
||||||
var cart = new ShoppingCart(new MusicStoreContext());
|
var cart = new ShoppingCart(new MusicStoreContext());
|
||||||
|
|
||||||
|
|
@ -28,12 +29,14 @@ namespace MusicStore.Models
|
||||||
|
|
||||||
private class CookiesFeature : IRequestCookiesFeature
|
private class CookiesFeature : IRequestCookiesFeature
|
||||||
{
|
{
|
||||||
private readonly RequestCookiesCollection _cookies;
|
private readonly IReadableStringCollection _cookies;
|
||||||
|
|
||||||
public CookiesFeature(string cookiesHeader)
|
public CookiesFeature(string key, string value)
|
||||||
{
|
{
|
||||||
_cookies = new RequestCookiesCollection();
|
_cookies = new ReadableStringCollection(new Dictionary<string, string[]>()
|
||||||
_cookies.Reparse(cookiesHeader);
|
{
|
||||||
|
{ key, new[] { value } }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public IReadableStringCollection Cookies
|
public IReadableStringCollection Cookies
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue