private static void MergeCarts_FromWithComponents() { System.Console.WriteLine("Begin MergeCarts_FromWithComponents"); var fromCart = Proxy.GetValue(ShopsContainer.Carts.ByKey("consolemergecartfromwithcomponents1")); AddCartLine(fromCart.Id, "Adventure Works Catalog|AW098 04|5", 1); Coupons.AddCouponToCart(fromCart.Id, "RTRNC15P"); fromCart = GetCart(fromCart.Id); var toCart = Proxy.GetValue(ShopsContainer.Carts.ByKey("consolemergecartfromwithcomponents2")); AddCartLine(toCart.Id, "Adventure Works Catalog|AW475 14|", 1); var commandResult = Proxy.DoCommand(ShopsContainer.MergeCarts(fromCart.Id, toCart.Id)); var model = commandResult.Models.OfType <PersistedEntityModel>().FirstOrDefault(); model.Should().NotBeNull(); var mergedCartId = model.EntityId; var mergedCart = GetCart(mergedCartId); mergedCart.Should().NotBeNull(); mergedCart.Lines.Should().NotBeEmpty(); mergedCart.Components.Should().NotBeEmpty(); fromCart.Components.ToList().ForEach(fc => { mergedCart.Components.ToList().FirstOrDefault(mc => mc.Id.Equals(fc.Id)).Should().NotBeNull(); }); DeleteCart(mergedCart.Id); }
static void Main(string[] args) { try { OpsServiceUri = Properties.Settings.Default.OpsServiceUri; ShopsServiceUri = Properties.Settings.Default.ShopsServiceUri; MinionsServiceUri = Properties.Settings.Default.MinionsServiceUri; AuthoringServiceUri = Properties.Settings.Default.AuthoringServiceUri; SitecoreIdServerUri = Properties.Settings.Default.SitecoreIdServerUri; UserName = Properties.Settings.Default.UserName; Password = Properties.Settings.Default.Password; SitecoreTokenRaw = SitecoreIdServerAuth.GetToken(); SitecoreToken = $"Bearer {SitecoreTokenRaw}"; var stopwatch = new Stopwatch(); stopwatch.Start(); Console.ForegroundColor = ConsoleColor.Cyan; if (ShouldBootstrapOnLoad) { Bootstrapping.RunScenarios(); Content.RunScenarios(); } if (ShouldDevOpsScenarios) { Environments.RunScenarios(); Plugins.RunScenarios(); Entities.RunScenarios(); Policies.RunScenarios(); Caching.RunScenarios(); } if (ShouldRunCatalogScenarios) { Catalogs.RunScenarios(); CatalogsUX.RunScenarios(); Categories.RunScenarios(); CategoriesUX.RunScenarios(); // TODO: contains failing tests SellableItems.RunScenarios(); SellableItemsUX.RunScenarios(); } if (ShouldRunPricingScenarios) { Pricing.RunScenarios(); PricingUX.RunScenarios(); } if (ShouldRunPromotionsScenarios) { Promotions.RunScenarios(); PromotionsUX.RunScenarios(); PromotionsRuntime.RunScenarios(); Rules.RunScenarios(); Coupons.RunScenarios(); CouponsUX.RunScenarios(); } if (ShouldRunInventoryScenarios) { Inventory.RunScenarios(); InventoryUX.RunScenarios(); } if (ShouldRunOrdersScenarios) { Fulfillments.RunScenarios(); Payments.RunScenarios(); PaymentsFederated.RunScenarios(); Carts.RunScenarios(); Returns.RunScenarios(); OrdersUX.RunScenarios(); Orders.RunScenarios(); Shipments.RunScenarios(); // ORDERS HAVE TO BE RELEASED FOR SHIPMENTS TO GET GENERATED } if (ShouldRunCustomersScenarios) { CustomersUX.RunScenarios(); } if (ShouldRunEntitlementsScenarios) { Entitlements.RunScenarios(); } if (ShouldRunSearchScenarios) { Search.RunScenarios(); } if (ShouldRunBusinessUsersScenarios) { ComposerUX.RunScenarios(); // Composer.RunScenarios(); } if (ShouldRunVersionScenarios) { Versions.RunScenarios(); } stopwatch.Stop(); Console.WriteLine($"Test Runs Complete - {stopwatch.ElapsedMilliseconds} ms - (Hit any key to continue)"); if (DemoStops) { Console.ReadKey(); } } catch (Exception ex) { ConsoleExtensions.WriteErrorLine("An unexpected exception occurred."); ConsoleExtensions.WriteErrorLine(ex.ToString()); } Console.WriteLine("done."); }