From 370475b8079d5ae18cce1e7ea9432a2469c46b94 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 31 Aug 2015 10:57:21 -0700 Subject: [PATCH] Use new HttpContext.Features API. --- test/MusicStore.Spa.Test/ShoppingCartTest.cs | 3 ++- test/MusicStore.Test/ManageControllerTest.cs | 3 ++- test/MusicStore.Test/ShoppingCartControllerTest.cs | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/MusicStore.Spa.Test/ShoppingCartTest.cs b/test/MusicStore.Spa.Test/ShoppingCartTest.cs index 3f4d3d35ee..22b5fac40b 100644 --- a/test/MusicStore.Spa.Test/ShoppingCartTest.cs +++ b/test/MusicStore.Spa.Test/ShoppingCartTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Features.Internal; using Microsoft.AspNet.Http.Internal; using Xunit; @@ -16,7 +17,7 @@ namespace MusicStore.Models var cartId = "cartId_A"; var httpContext = new DefaultHttpContext(); - httpContext.SetFeature(new CookiesFeature("Session", cartId)); + httpContext.Features.Set(new CookiesFeature("Session", cartId)); var cart = new ShoppingCart(new MusicStoreContext()); diff --git a/test/MusicStore.Test/ManageControllerTest.cs b/test/MusicStore.Test/ManageControllerTest.cs index 89bb140045..ecaf16ce6e 100644 --- a/test/MusicStore.Test/ManageControllerTest.cs +++ b/test/MusicStore.Test/ManageControllerTest.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Features.Authentication; using Microsoft.AspNet.Http.Features.Authentication.Internal; using Microsoft.AspNet.Http.Internal; @@ -34,7 +35,7 @@ namespace MusicStore.Controllers // IHttpContextAccessor is required for SignInManager, and UserManager var context = new DefaultHttpContext(); - context.SetFeature(new HttpAuthenticationFeature() { Handler = new TestAuthHandler() }); + context.Features.Set(new HttpAuthenticationFeature() { Handler = new TestAuthHandler() }); services.AddInstance( new HttpContextAccessor() { diff --git a/test/MusicStore.Test/ShoppingCartControllerTest.cs b/test/MusicStore.Test/ShoppingCartControllerTest.cs index 897352ecc5..1e547de0bb 100644 --- a/test/MusicStore.Test/ShoppingCartControllerTest.cs +++ b/test/MusicStore.Test/ShoppingCartControllerTest.cs @@ -4,11 +4,12 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Antiforgery; -using Microsoft.Data.Entity; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Features.Internal; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc; +using Microsoft.Data.Entity; using Microsoft.Framework.DependencyInjection; using MusicStore.Models; using MusicStore.ViewModels; @@ -180,7 +181,7 @@ namespace MusicStore.Controllers // ServiceProvder initialization var serviceProviderFeature = new ServiceProvidersFeature(); - httpContext.SetFeature(serviceProviderFeature); + httpContext.Features.Set(serviceProviderFeature); // AntiForgery initialization serviceProviderFeature.RequestServices = _serviceProvider;