Reacting to HttpAbstractions changes

This commit is contained in:
Pranav K 2015-08-31 10:31:58 -07:00
parent ef24402f1d
commit 1c986b3bb5
6 changed files with 7 additions and 6 deletions

View File

@ -185,7 +185,7 @@ namespace MusicStore.Models
// We're using HttpContextBase to allow access to cookies. // We're using HttpContextBase to allow access to cookies.
public string GetCartId(HttpContext context) public string GetCartId(HttpContext context)
{ {
var sessionCookie = context.Request.Cookies.Get("Session"); var sessionCookie = context.Request.Cookies["Session"];
string cartId = null; string cartId = null;
if (string.IsNullOrWhiteSpace(sessionCookie)) if (string.IsNullOrWhiteSpace(sessionCookie))

View File

@ -41,7 +41,7 @@ namespace MusicStore.Controllers
try try
{ {
if (string.Equals(formCollection.GetValues("PromoCode").FirstOrDefault(), PromoCode, if (string.Equals(formCollection["PromoCode"].FirstOrDefault(), PromoCode,
StringComparison.OrdinalIgnoreCase) == false) StringComparison.OrdinalIgnoreCase) == false)
{ {
return View(order); return View(order);

View File

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Antiforgery; using Microsoft.AspNet.Antiforgery;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Framework.Primitives;
using MusicStore.Models; using MusicStore.Models;
using MusicStore.ViewModels; using MusicStore.ViewModels;
@ -61,7 +62,7 @@ namespace MusicStore.Controllers
{ {
var cookieToken = string.Empty; var cookieToken = string.Empty;
var formToken = string.Empty; var formToken = string.Empty;
string[] tokenHeaders = null; StringValues tokenHeaders;
string[] tokens = null; string[] tokens = null;
if (Context.Request.Headers.TryGetValue("RequestVerificationToken", out tokenHeaders)) if (Context.Request.Headers.TryGetValue("RequestVerificationToken", out tokenHeaders))

View File

@ -24,7 +24,7 @@ namespace MusicStore.Mocks.Facebook
{ {
if (queryParameters["code"] == "ValidCode") if (queryParameters["code"] == "ValidCode")
{ {
Helpers.ThrowIfConditionFailed(() => queryParameters["redirect_uri"].EndsWith("signin-facebook"), "Redirect URI is not ending with /signin-facebook"); Helpers.ThrowIfConditionFailed(() => ((string)queryParameters["redirect_uri"]).EndsWith("signin-facebook"), "Redirect URI is not ending with /signin-facebook");
Helpers.ThrowIfConditionFailed(() => queryParameters["client_id"] == "[AppId]", "Invalid client Id received"); Helpers.ThrowIfConditionFailed(() => queryParameters["client_id"] == "[AppId]", "Invalid client Id received");
Helpers.ThrowIfConditionFailed(() => queryParameters["client_secret"] == "[AppSecret]", "Invalid client secret received"); Helpers.ThrowIfConditionFailed(() => queryParameters["client_secret"] == "[AppSecret]", "Invalid client secret received");
response.Content = new StringContent("access_token=ValidAccessToken&expires=100"); response.Content = new StringContent("access_token=ValidAccessToken&expires=100");

View File

@ -24,7 +24,7 @@ namespace MusicStore.Mocks.Google
{ {
if (formData["code"] == "ValidCode") if (formData["code"] == "ValidCode")
{ {
if (formData["redirect_uri"] != null && formData["redirect_uri"].EndsWith("signin-google") && if (formData["redirect_uri"] != null && ((string)formData["redirect_uri"]).EndsWith("signin-google") &&
formData["client_id"] == "[ClientId]" && formData["client_secret"] == "[ClientSecret]") formData["client_id"] == "[ClientId]" && formData["client_secret"] == "[ClientSecret]")
{ {
response.Content = new StringContent("{\"access_token\":\"ValidAccessToken\",\"refresh_token\":\"ValidRefreshToken\",\"token_type\":\"Bearer\",\"expires_in\":\"1200\",\"id_token\":\"Token\"}", Encoding.UTF8, "application/json"); response.Content = new StringContent("{\"access_token\":\"ValidAccessToken\",\"refresh_token\":\"ValidRefreshToken\",\"token_type\":\"Bearer\",\"expires_in\":\"1200\",\"id_token\":\"Token\"}", Encoding.UTF8, "application/json");

View File

@ -24,7 +24,7 @@ namespace MusicStore.Mocks.MicrosoftAccount
{ {
if (formData["code"] == "ValidCode") if (formData["code"] == "ValidCode")
{ {
if (formData["redirect_uri"] != null && formData["redirect_uri"].EndsWith("signin-microsoft") && if (formData["redirect_uri"] != null && ((string)formData["redirect_uri"]).EndsWith("signin-microsoft") &&
formData["client_id"] == "[ClientId]" && formData["client_secret"] == "[ClientSecret]") formData["client_id"] == "[ClientId]" && formData["client_secret"] == "[ClientSecret]")
{ {
response.Content = new StringContent("{\"token_type\":\"bearer\",\"expires_in\":3600,\"scope\":\"wl.basic\",\"access_token\":\"ValidAccessToken\",\"refresh_token\":\"ValidRefreshToken\",\"authentication_token\":\"ValidAuthenticationToken\"}"); response.Content = new StringContent("{\"token_type\":\"bearer\",\"expires_in\":3600,\"scope\":\"wl.basic\",\"access_token\":\"ValidAccessToken\",\"refresh_token\":\"ValidRefreshToken\",\"authentication_token\":\"ValidAuthenticationToken\"}");