Пример #1
0
        private static void OrderEntitlements(ShopperContext context)
        {
            using (new SampleMethodScope())
            {
                var orderId = Simple2PhysicalDigitalItems.Run(context);
                orderId.Should().NotBeNull();

                Orders.RunPendingOrdersMinion(context);
                Orders.RunReleasedOrdersMinion(context);

                var result = Proxy.GetValue(
                    ShopsContainer.GetEntityView(orderId, "OrderEntitlements", string.Empty, string.Empty));
                result.Should().NotBeNull();
                result.Policies.Should().NotBeEmpty();
                result.Properties.Should().NotBeEmpty();
                result.ChildViews.Should().NotBeEmpty();
                foreach (var childView in result.ChildViews.Cast <EntityView>())
                {
                    childView.Should().NotBeNull();
                    childView.Policies.Should().BeEmpty();
                    childView.Properties.Should().NotBeEmpty();
                    childView.Properties.All(p => !string.IsNullOrEmpty(p.Value)).Should().BeTrue();
                    childView.ChildViews.Should().BeEmpty();
                }
            }
        }
Пример #2
0
        public static void RunScenarios()
        {
            using (new SampleScenarioScope("Orders UX"))
            {
                try
                {
                    var jeff = new AnonymousCustomerJeff();
                    _orderId = Simple2PhysicalDigitalItems.Run(jeff.Context);
                    _orderId.Should().NotBeNull();
                    HoldOrder(_orderId);

                    OrderFulfillments();

                    SetFulfillment_Digital();
                    SetFulfillment_ShipToMe();
                    SetFulfillment_Split();

                    OrderPayments();
                    VoidPayment_Federated();
                    AddPayment_Federated(64.23M);

                    UndoOnHoldOrder();

                    OrderEntitlements(jeff.Context);

                    OnHoldScenarios();

                    // Run Federated Scenarios
                    var bob = new AnonymousCustomerBob();
                    _orderId = SimplePhysicalDigitalItemsFederatedPayment.Run(bob.Context);
                    _orderId.Should().NotBeNull();
                    HoldOrder(_orderId);

                    OrderFulfillments();

                    SetFulfillment_Digital();
                    SetFulfillment_ShipToMe();
                    SetFulfillment_Split();

                    OrderPayments();
                    VoidPayment_Federated();
                    AddPayment_Federated(64.23M);
                    RefundPayment_Federated();

                    _orderId = SimplePhysical2Items.Run(jeff.Context);
                    _orderId.Should().NotBeNull();
                    HoldOrder(_orderId);

                    AddPayment_GiftCard();

                    UndoOnHoldOrder();
                }
                catch (Exception ex)
                {
                    ConsoleExtensions.WriteErrorLine($"Exception in Scenario 'OrdersUX' (${ex.Message}) : Stack={ex.StackTrace}");
                }
            }
        }
        private static void BuyPhysicalAndGiftCard(ShopperContext context)
        {
            using (new SampleMethodScope())
            {
                var orderId = Simple2PhysicalDigitalItems.Run(context);
                orderId.Should().NotBeNull();

                RunMinions(context);

                var order = ValidateOrder(context, orderId);
                ValidateEntitlements(context, order, null, 1, typeof(GiftCard));
            }
        }