コード例 #1
0
        public void CartViewModel_Clears_CartLineViewModels()
        {
            //arrange
            Mock <IBusinessLogicLayer> mockOfBusinessLogicLayer = new Mock <IBusinessLogicLayer>();
            //act
            CartViewModel result = new CartViewModel(mockOfBusinessLogicLayer.Object);

            result.CartLineViewModels = new List <CartLineViewModel>
            {
                new CartLineViewModel {
                    CartLineId = 1, ProductId = 1, Product = new Product {
                        ProductId = 1, Price = 50m
                    }, Quantity = 5
                },
                new CartLineViewModel {
                    CartLineId = 2, ProductId = 2, Product = new Product {
                        ProductId = 2, Price = 150m
                    }, Quantity = 7
                },
                new CartLineViewModel {
                    CartLineId = 3, ProductId = 3, Product = new Product {
                        ProductId = 3, Price = 250m
                    }, Quantity = 9
                }
            };
            result.Clear();
            //assert
            Assert.IsTrue(result.CartLineViewModels.Count == 0);
        }
コード例 #2
0
 public ViewResult Completed()
 {
     cart.Clear();
     return(View());
 }
コード例 #3
0
 public void OnCheckout(object sender, EventArgs args)
 {
     // TODO
     DisplayAlert("Your Order has been placed!", "Thank you for ordering", "OK");
     _viewModel.Clear();
 }