public static ShoppingCart GetCart(MusicStoreContext db, HttpContext context) { var cart = new ShoppingCart(db); cart.ShoppingCartId = cart.GetCartId(context); return(cart); }
public static ShoppingCart GetCart(HttpContextBase context) { var cart = new ShoppingCart(); cart.ShoppingCartId = cart.GetCartId(context); return(cart); }
public static ShoppingCart GetCart(HttpContextBase context) { var cart = new ShoppingCart(); //visszaadja a felhasználó nevét, vagy egy üres stringet ("") cart.ShoppingCartId = cart.GetCartId(context); return(cart); }
public void GetCartId_ReturnsCartIdFromCookies() { // Arrange var cartId = "cartId_A"; var httpContext = new DefaultHttpContext(); httpContext.SetFeature<IRequestCookiesFeature>(new CookiesFeature("Session=" + cartId)); var cart = new ShoppingCart(new MusicStoreContext()); // Act var result = cart.GetCartId(httpContext); // Assert Assert.NotNull(result); Assert.Equal(cartId, result); }
public void GetCartId_ReturnsCartIdFromCookies() { // Arrange var cartId = "cartId_A"; var httpContext = new DefaultHttpContext(); httpContext.SetFeature <IRequestCookiesFeature>(new CookiesFeature("Session", cartId)); var cart = new ShoppingCart(new MusicStoreContext()); // Act var result = cart.GetCartId(httpContext); // Assert Assert.NotNull(result); Assert.Equal(cartId, result); }
public static ShoppingCart GetCart(MusicStoreContext db, HttpContext context) { var cart = new ShoppingCart(db); cart.ShoppingCartId = cart.GetCartId(context); return cart; }
public static ShoppingCart GetCart(HttpContextBase context) { var cart = new ShoppingCart(); cart.ShoppingCartId = cart.GetCartId(context); return cart; }