本文整理汇总了C#中SportsStore.WebUI.Controllers.CartController.Index方法的典型用法代码示例。如果您正苦于以下问题:C# CartController.Index方法的具体用法?C# CartController.Index怎么用?C# CartController.Index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SportsStore.WebUI.Controllers.CartController
的用法示例。
在下文中一共展示了CartController.Index方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_View_Cart_Content
public void Can_View_Cart_Content()
{
Cart cart = new Cart();
CartController target = new CartController(null, null);
CartIndexViewModel res = (CartIndexViewModel)target.Index(cart, "MyUrl").ViewData.Model;
Assert.AreSame(res.Cart, cart);
Assert.AreEqual(res.ReturnUrl, "MyUrl");
}
示例2: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
// Arrange - create a Cart
Cart cart = new Cart();
// Arrange - create the controller
CartController target = new CartController(null, null);
// Act - call the Index action method
CartIndexViewModel result
= (CartIndexViewModel)target.Index(cart, "myUrl").ViewData.Model;
// Assert
Assert.AreSame(result.Cart, cart);
Assert.AreEqual(result.ReturnUrl, "myUrl");
}
示例3: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
//arrange create a cart
Cart cart = new Cart();
// arrange create the controller
CartController controller = new CartController(null, null);
// act call the index action method
var result = (CartIndexViewModel)controller.Index(cart, "myUrl").ViewData.Model;
// assert
Assert.AreEqual(result.Cart, cart);
Assert.AreEqual(result.ReturnUrl, "myUrl");
}
示例4: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
// Arrange - Cart 개체를 생성한다.
Cart cart = new Cart();
// Arrange - 컨트롤러를 생성한다.
CartController target = new CartController(null, null);
// Act - Index 액션 메서드를 호출한다.
CartIndexViewmodel result = (CartIndexViewmodel)target.Index(cart, "myUrl").ViewData.Model;
//Assert
Assert.AreSame(result.Cart, cart);
Assert.AreEqual(result.ReturnUrl, "myUrl");
}
示例5: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
Cart cart = new Cart();
CartController target = new CartController(null, null);
CartIndexViewModel result = (CartIndexViewModel)target.Index(cart, "myURL").ViewData.Model;
Assert.AreSame(result.Cart, cart);
Assert.AreEqual(result.ReturnURL, "myURL");
}
示例6: CanViewCartContents
public void CanViewCartContents()
{
//arrange
var cart = new Cart();
//arrange
var target = new CartController(null, null);
//act
var result = (CartIndexViewModel) target.Index(cart, "myUrl").ViewData.Model;
//assert
Assert.AreEqual(cart, result.Cart);
Assert.AreEqual("myUrl", result.ReturnUrl);
}
示例7: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
// arrange - creat a cart
Cart cart = new Cart();
// arrange create the controller
CartController target = new CartController(null, new EmailOrderProcessor(new EmailSettings()));
// act - call the index action method
CartIndexViewModel result = (CartIndexViewModel)target.Index(cart, "myUrl").ViewData.Model;
// assert
Assert.AreSame(result.Cart, cart);
Assert.AreEqual(result.ReturnUrl, "myUrl");
}
示例8: CanViewCartContents
public void CanViewCartContents()
{
Cart cart = new Cart();
CartController controller = new CartController(null, null);
CartIndexViewModel result = (CartIndexViewModel) controller.Index(cart, "myUrl").ViewData.Model;
Assert.AreSame(result.Cart, cart);
Assert.AreEqual(result.ReturnUrl, "myUrl");
}
示例9: CartController_Index_CanViewCartContents
public void CartController_Index_CanViewCartContents()
{
// Arrange
Cart cart = new Cart();
var target = new CartController(null, null);
// Act
var result = (CartIndexViewModel)target.Index(cart, "myUrl").ViewData.Model;
// Assert
Assert.AreEqual<Cart>(result.Cart, cart);
Assert.AreEqual<string>(result.ReturnUrl, "myUrl");
}
示例10: Can_view_cart_contents
public void Can_view_cart_contents()
{
var cart = new Cart();
var controller = new CartController(null, null);
var result = (CartIndexViewModel)controller.Index(cart, "myurl").ViewData.Model;
Assert.AreSame(cart, result.Cart);
Assert.AreEqual("myurl", result.ReturnUrl);
}
示例11: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
var productsArray = products.Products.ToArray();
Cart cart = new Cart();
CartController target = new CartController(products, orderProcessor);
CartIndexViewModel result = (CartIndexViewModel)((ViewResult)target.Index(cart, "testUrl")).ViewData.Model;
Assert.AreEqual(result.returnUrl, "testUrl");
Assert.AreEqual(result.cart, cart);
}
示例12: Can_View_Cart_Contest
public void Can_View_Cart_Contest()
{
//Arrange
Cart cart=new Cart();
CartController target=new CartController(null,null);
//Act
CartIndexViewModel result = (CartIndexViewModel) target
.Index(cart, "myUrl").ViewData.Model;
//Assert
Assert.AreEqual(result.Cart,cart);
Assert.AreEqual(result.ReturnUrl,"myUrl");
}
示例13: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
var url = "someUrl";
// Arrange - create a cart
Cart cart = new Cart();
// Arrange - create the controller
CartController controller = new CartController(null);
// Act
var actionResult = controller.Index(url, cart);
var model = (CartIndexViewModel) actionResult.Model;
Assert.AreSame(model.Cart,cart);
Assert.AreSame(model.ReturnUrl, url);
}
示例14: Can_View_Cart_Contents
public void Can_View_Cart_Contents()
{
// Arrange
Cart cart = new Cart();
CartController controller = new CartController(null, null);
// Act
CartIndexViewModel model = (CartIndexViewModel)controller.Index(cart, "myUrl").Model;
// Assert
Assert.AreEqual(model.Cart, cart);
Assert.AreEqual(model.ReturnUrl, "myUrl");
}