Ejemplo n.º 1
0
        public bool OrderPlacing(OrderProcessingModal modal)
        {
            try
            {
                //ToDo: Logic to add the order into table.
                // now check the payment for product category

                switch (modal.PaymentCategory)
                {
                case PaymentFor.PhysicalProduct:
                    _packingSlip.GeneratePackingSlip(new PackingslipForShippingModal());
                    _commisionService.PayCommision();
                    break;

                case PaymentFor.Membership:
                    _membership.AddUpdateMembership(new MembershipModal());
                    break;

                case PaymentFor.Video:
                    // add the logic according to the norms...
                    break;

                default:
                    break;
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
                //ToDo: Handle the exception
            }
        }
        public void OrderPlacing_Test(int quantity, PaymentFor paymentCategory, string Name, decimal price, bool IsActive)
        {
            var objModal = new OrderProcessingModal
            {
                IsShipped       = false,
                IsActive        = true,
                Name            = Name,
                OrderDate       = new DateTime(),
                PaymentCategory = paymentCategory,
                Quantity        = quantity,
                Price           = price,
            };

            var objValidator = ObjectModalValidator.Validate(objModal);

            Assert.AreEqual(0, objValidator.Count);
            var result = _orderService.OrderPlacing(objModal);

            Assert.IsNotNull(result);
        }