Exemplo n.º 1
0
        public void TestBasketServices_Basket_IsCreated_If_None_Exists_For_User()
        {
            var sa = GetUserSessionModel("*****@*****.**");

            var basket = service.GetUserBasketModel(sa).Model as UserBasketModel;

            Assert.IsNotNull(basket);
        }
        public void TestQuoteServices_Import_Items_Cannot_Import_Product_Which_Is_Non_Commissionable_Into_CommissionableQuote()
        {
            var user = GetUserSessionModel("*****@*****.**");

            var quote = GetActiveQuoteModel(user, "Project 4");

            quote.IsCommissionScheme = true; //make a change to recalculate totals
            quote.Multiplier         = 0.6M;
            var response = service.PostModel(user, quote);

            Assert.IsTrue(response.Messages.Items.Any(i => i.Text == Resources.ResourceModelProject.MP019));

            // Switch all products in quote to commission
            var items = this.db.QuoteItemsByQuoteId(user, quote.QuoteId).Include(q => q.Product).Include(q => q.Quote).ToList();

            items.ForEach(i => i.Product.AllowCommissionScheme = true);
            items[0].Quote.IsCommissionScheme = true; //set quote to commissinable
            this.db.SaveChanges();

            response.Messages.Clear();
            quote    = GetActiveQuoteModel(user, "Project 4");
            response = service.PostModel(user, quote);
            Assert.IsTrue(response.IsOK);

            //Fill basket
            var basket = serviceBasket.GetUserBasketModel(user).Model as UserBasketModel;
            var nonCommissionProduct = this.db.Products.Where(p => p.AllowCommissionScheme == false).FirstOrDefault();

            response = service.AddProductToQuote(user, quote, nonCommissionProduct.ProductId, 2);
            Assert.IsTrue(response.Messages.Items.Any(i => i.Text == Resources.ResourceModelProject.MP019));
        }
        public ActionResult Basket()
        {
            this.ServiceResponse = basketService.GetUserBasketModel(this.CurrentUser);

            ProcessServiceResponse(this.ServiceResponse);

            return(PartialView("Basket", this.ServiceResponse.Model));
        }
Exemplo n.º 4
0
 public ServiceResponse GetBasket()
 {
     return(basketService.GetUserBasketModel(this.CurrentUser));
 }