Пример #1
0
        public void Setup()
        {
            _orderWithPhysicalProduct = new Order(new OrderConfig {
                Id = "Order With Physical Product"
            });
            _orderWithPhysicalProduct.SetProduct(new Product(new ProductConfig {
                Type = "Physical", SubType = "Video"
            }));

            _orderWithBook = new Order(new OrderConfig {
                Id = "Order With Book"
            });
            _orderWithBook.SetProduct(new Product(new ProductConfig {
                SubType = "Book"
            }));

            _orderWithAnythingElse = new Order(new OrderConfig {
                Id = "Order With Anything Else"
            });
            _orderWithAnythingElse.SetProduct(new Product(new ProductConfig {
                Type = "Anything Else"
            }));

            _generateCommissionPayment = new GenerateCommissionPayment(new Mock <IServiceBus>().Object);
        }
Пример #2
0
        public void Setup()
        {
            _mockOrder = new Mock <Order>();
            _mockOrder.SetupGet(m => m.Id).Returns("Expected Order Id");
            _mockOrder.SetupGet(m => m.AgentId).Returns("Expected Agent Id");

            _mockServiceBus = new Mock <IServiceBus>();

            _generateCommissionPayment = new GenerateCommissionPayment(_mockServiceBus.Object);
        }
        public Result RunBusinessRuleEngine(PaymentType type)
        {
            switch (type)
            {
            case PaymentType.PHYSICAL_PRODUCT:
            {
                var generateCommissionPayment = new GenerateCommissionPayment();
                var packingSlip = new GeneratePackingSlip(generateCommissionPayment);
                return(packingSlip.Process());
            }

            case PaymentType.BOOK:
            {
                var generateCommissionPayment = new GenerateCommissionPayment();
                var GeneratePackingSlipForRoyaltyDepartment = new GeneratePackingSlipForRoyaltyDepartment(generateCommissionPayment);
                return(GeneratePackingSlipForRoyaltyDepartment.Process());
            }

            case PaymentType.MEMBERSHIP_ACTIVATE:
            {
                var sendEmailNotifification = new EMailNotification();
                var activateMemberShip      = new ActivateMemberShip(sendEmailNotifification);
                return(activateMemberShip.Process());
            }

            case PaymentType.MEMBERSHIP_UPGRADE:
            {
                var sendEmailNotifification = new EMailNotification();
                var applyUpgrade            = new ApplyUpgrade(sendEmailNotifification);
                return(applyUpgrade.Process());
            }

            case PaymentType.VIDEO:
            {
                var addFirstAidVideo = new AddFirstAidVideo();
                var packingSlip      = new GeneratePackingSlip(addFirstAidVideo);
                return(packingSlip.Process());
            }

            default:
                return(new Result((int)Status.FAIL, "payment type is not found"));
            }
        }