private static void AddSellableItemImage() { using (new SampleMethodScope()) { EngineExtensions.AddSellableItemImage(Product1Id, CatalogName, ImageId); } }
private static void EnableSellableItemVariant() { using (new SampleMethodScope()) { EngineExtensions.EnableSellableItemVariant(_variant1Name, _product1Name, CatalogName, CatalogName); } }
private static void DeleteCatalog() { using (new SampleMethodScope()) { EngineExtensions.DeleteCatalog(CatalogName); } }
public static void RunScenarios() { using (new SampleScenarioScope(MethodBase.GetCurrentMethod().DeclaringType.Name)) { var partial = $"{Guid.NewGuid():N}".Substring(0, 3); _categoryName = $"SellableItemUXCategory{partial}"; _product1Name = $"ConsoleProduct1{partial}"; _product2Name = $"ConsoleProduct2{partial}"; _variant1Name = $"ConsoleVariant1{partial}"; _categoryId = _categoryName.ToEntityId <Category>(CatalogName); _product1Id = _product1Name.ToEntityId <SellableItem>(); _product2Id = _product2Name.ToEntityId <SellableItem>(); EngineExtensions.AddCategory(_categoryId, CatalogId, CatalogName); AddSellableItemToCatalog(); AddSellableItemToCategory(); AddSellableItemVariant(); DisableSellableItemVariant(); EnableSellableItemVariant(); DeleteSellableItemVariant(); AssociateSellableItemToCatalog(); AssociateSellableItemToCategory(); DissassociateSellableItemFromCatalog(); DissassociateSellableItemFromCategory(); AddSellableItemImage(); RemoveSellableItemImage(); EngineExtensions.DeleteSellableItem(_product1Id, _categoryId, _categoryName, CatalogName); EngineExtensions.DeleteSellableItem(_product2Id, _categoryId, _categoryName, CatalogName); EngineExtensions.DeleteCategory(_categoryId); } }
private static async Task ImportCatalogsReplace() { using (new SampleMethodScope()) { // The catalog ConsoleCatalog should not exist before performing the import. var getCatalogResult = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.Catalogs.ByKey(CatalogName)); getCatalogResult.Should().BeNull(); ConsoleExtensions.WriteExpectedError(); await EngineExtensions.ImportCatalogs(CatalogExportFilePath, "replace"); getCatalogResult = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.Catalogs.ByKey(CatalogName)); getCatalogResult.Should().NotBeNull(); // Temporary workaround for 9.0.3 bug - need to manually associate // inventory, price book, and promotion book to catalog after import EngineExtensions.AssociateCatalogToInventorySet("Adventure Works Inventory", "Adventure Works Catalog"); Proxy.DoCommand(EngineExtensions.AuthoringContainer.Value.AssociateCatalogToPriceBook("AdventureWorksPriceBook", "Adventure Works Catalog")); var view = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.GetEntityView("Entity-PromotionBook-AdventureWorksPromotionBook", "PromotionBookCatalogs", "AssociateCatalog", string.Empty)); var version = view.Properties.FirstOrDefault(p => p.Name.Equals("Version")); view.Properties = new ObservableCollection <ViewProperty> { new ViewProperty { Value = "Adventure Works Catalog", Name = "CatalogName" }, version }; var result = Proxy.DoCommand(EngineExtensions.AuthoringContainer.Value.DoAction(view)); } }
public static void RunPendingOrdersMinion(ShopperContext context) { EngineExtensions.RunMinionWithRetry( "Sitecore.Commerce.Plugin.Orders.PendingOrdersMinionBoss, Sitecore.Commerce.Plugin.Orders", ResolveMinionEnvironment(context), true); }
private static async Task ImportInventorySetsReplace() { using (new SampleMethodScope()) { await EngineExtensions.ImportInventorySets(InventoryExportFilePath, "replace", "CatalogAlreadyAssociated"); var inventoryInfo1 = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.InventoryInformation.ByKey(ProductInventoryInfo1Id).Expand("Components($expand=ChildComponents)")); inventoryInfo1.Should().NotBeNull(); inventoryInfo1.Quantity.Should().Be(UpdatedQuantity); var backorderComponent1 = inventoryInfo1.Components.OfType <BackorderableComponent>().FirstOrDefault(); backorderComponent1.Should().NotBeNull(); backorderComponent1.Backorderable.Should().BeFalse(); backorderComponent1.BackorderAvailabilityDate.HasValue.Should().BeFalse(); backorderComponent1.BackorderLimit.Should().Be(0); var inventoryInfo2 = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.InventoryInformation.ByKey(ProductInventoryInfo2Id).Expand("Components($expand=ChildComponents)")); inventoryInfo2.Should().NotBeNull(); inventoryInfo2.Quantity.Should().Be(UpdatedQuantity); var backorderComponent2 = inventoryInfo2.Components.OfType <BackorderableComponent>().FirstOrDefault(); backorderComponent2.Should().NotBeNull(); backorderComponent2.Backorderable.Should().BeTrue(); backorderComponent2.BackorderAvailabilityDate.Should().BeCloseTo(BackorderAvailabilityDate, 1000); backorderComponent2.BackorderLimit.Should().Be(BackorderLimit); } }
private static void AddSellableItemVariant() { using (new SampleMethodScope()) { EngineExtensions.AddSellableItemVariant(Variant1Name, Product1Name, CatalogName, CatalogName); } }
private static void EditInventoryInformation2() { using (new SampleMethodScope()) { EngineExtensions.EditInventoryInformation(InventorySet2Name, ProductId, new System.Collections.Generic.List <ViewProperty> { new ViewProperty { Name = "Quantity", Value = UpdatedQuantity.ToString(), OriginalType = typeof(int).FullName }, new ViewProperty { Name = "Backorderable", Value = "true", OriginalType = typeof(bool).FullName }, new ViewProperty { Name = "BackorderAvailabilityDate", Value = BackorderAvailabilityDate.ToString(), OriginalType = typeof(DateTimeOffset).FullName }, new ViewProperty { Name = "BackorderLimit", Value = BackorderLimit.ToString(), OriginalType = typeof(int).FullName } }); var inventoryInfo2 = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.InventoryInformation.ByKey(ProductInventoryInfo2Id).Expand("Components($expand=ChildComponents)")); inventoryInfo2.Should().NotBeNull(); inventoryInfo2.Quantity.Should().Be(UpdatedQuantity); var backorderComponent2 = inventoryInfo2.Components.OfType <BackorderableComponent>().FirstOrDefault(); backorderComponent2.Should().NotBeNull(); backorderComponent2.Backorderable.Should().BeTrue(); backorderComponent2.BackorderAvailabilityDate.HasValue.Should().BeTrue(); backorderComponent2.BackorderAvailabilityDate.Value.Should().BeCloseTo(BackorderAvailabilityDate, 1000); backorderComponent2.BackorderLimit.Should().Be(BackorderLimit); } }
private static async Task ExportInventorySetsFull() { using (new SampleMethodScope()) { await EngineExtensions.ExportInventorySets(InventoryExportFilePath, "full"); } }
private static void EditInventoryInformation1() { using (new SampleMethodScope()) { EngineExtensions.EditInventoryInformation( _inventorySet1Name, _productId, new List <ViewProperty> { new ViewProperty { Name = "Quantity", Value = UpdatedQuantity.ToString(), OriginalType = typeof(int).FullName } }); var inventoryInfo1 = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.InventoryInformation.ByKey(_productInventoryInfo1Id).Expand("Components($expand=ChildComponents)")); inventoryInfo1.Should().NotBeNull(); inventoryInfo1.Quantity.Should().Be(UpdatedQuantity); var backorderComponent1 = inventoryInfo1.Components.OfType <BackorderableComponent>().FirstOrDefault(); backorderComponent1.Should().NotBeNull(); backorderComponent1.Backorderable.Should().BeFalse(); backorderComponent1.BackorderAvailabilityDate.HasValue.Should().BeFalse(); backorderComponent1.BackorderLimit.Should().Be(0); } }
private static void AddCatalog() { using (new SampleMethodScope()) { // test for validation error var view = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.GetEntityView(string.Empty, "Details", "AddCatalog", string.Empty)); view.Should().NotBeNull(); view.Policies.Should().BeEmpty(); view.Properties.Should().NotBeEmpty(); view.ChildViews.Should().BeEmpty(); view.Properties = new ObservableCollection <ViewProperty> { new ViewProperty { Name = "Name", Value = $"{CatalogName}$%^*&{{" }, }; var result = Proxy.DoCommand(EngineExtensions.AuthoringContainer.Value.DoAction(view)); result.Messages.Should().ContainMessageCode("validationerror"); ConsoleExtensions.WriteExpectedError(); // Create a valid catalog EngineExtensions.AddCatalog(CatalogName, "Console UX Catalog"); } }
private static void AssociateCatalogToInventorySet() { using (new SampleMethodScope()) { EngineExtensions.AssociateCatalogToInventorySet(InventorySet1Name, Catalog1Name); EngineExtensions.AssociateCatalogToInventorySet(InventorySet2Name, Catalog2Name); } }
private static void DisassociateSellableItemFromInventorySet() { using (new SampleMethodScope()) { EngineExtensions.DisassociateSellableItemFromInventorySet(InventorySet1Name, ProductId); EngineExtensions.DisassociateSellableItemFromInventorySet(InventorySet2Name, ProductId); } }
private static void AddInventorySet() { using (new SampleMethodScope()) { EngineExtensions.AddInventorySet(InventorySet1Name); EngineExtensions.AddInventorySet(InventorySet2Name); } }
private static void AssociateSellableItemToInventorySet() { using (new SampleMethodScope()) { EngineExtensions.AssociateSellableItemToInventorySet(InventorySet1Name, ProductId, InitialQuantity); EngineExtensions.AssociateSellableItemToInventorySet(InventorySet2Name, ProductId, InitialQuantity); } }
private static void DeleteInventorySet() { using (new SampleMethodScope()) { EngineExtensions.AddInventorySet(_inventorySet3Name); EngineExtensions.DeleteInventorySet(_inventorySet3Id); } }
private static void AddCategoryToCatalog() { using (new SampleMethodScope()) { EngineExtensions.AssertCatalogExists(CatalogId); EngineExtensions.AddCategory(ParentCategoryId, CatalogId, CatalogName); } }
private static void AddCategoryToCategory() { using (new SampleMethodScope()) { EngineExtensions.AssertCategoryExists(_parentCategoryId); EngineExtensions.AddCategory(_childCategoryId, _parentCategoryId, _parentCategoryName); } }
// Use this for initialization void Start() { if (SatelliteLibrary.Running) { // Execute OnSessionFound when a session has been found EngineExtensions.OnSessionJoined(SessionJoined); } }
private static void DissassociateSellableItemFromCatalog() { using (new SampleMethodScope()) { // Remove Product2 from the catalog root EngineExtensions.AssertChildViewItemExists(CatalogId, ChildViewNames.SellableItems, Product2Id); EngineExtensions.DisassociateItem(Product2Id, Product2Name, CatalogId, CatalogName); } }
private static void DissassociateSellableItemFromCategory() { using (new SampleMethodScope()) { // Remove Product1 from the category EngineExtensions.AssertChildViewItemExists(_categoryId, ChildViewNames.SellableItems, _product1Id); EngineExtensions.DisassociateItem(_product1Id, _product1Name, _categoryId, _categoryName); } }
private static void AddSellableItemToCategory() { using (new SampleMethodScope()) { // Add Product2 to the category. EngineExtensions.AssertCategoryExists(CategoryId); EngineExtensions.AddSellableItem(Product2Id, CategoryId, CategoryName, CatalogName); } }
private static void AddSellableItemToCatalog() { using (new SampleMethodScope()) { // Add Product1 to the catalog root. EngineExtensions.AssertCatalogExists(CatalogId); EngineExtensions.AddSellableItem(Product1Id, CatalogId, CatalogName, CatalogName); } }
public static void RunRefundRmasMinion(Container container, string rmaId, string environmentName = "AdventureWorksMinions") { EngineExtensions.RunMinionWithRetry( "Sitecore.Commerce.Plugin.Returns.RefundRmasMinion, Sitecore.Commerce.Plugin.Returns", environmentName); var rma = GetRma(container, rmaId); rma.Status.Should().Be("Completed"); }
private static async Task ExportCatalogsFull() { using (new SampleMethodScope()) { var getCatalogResult = Proxy.GetValue(EngineExtensions.AuthoringContainer.Value.Catalogs.ByKey(CatalogName)); getCatalogResult.Should().NotBeNull(); await EngineExtensions.ExportCatalogs(CatalogExportFilePath); } }
public static void RunPurgeCartsMinion() { EngineExtensions.RunMinionWithRetry( "Sitecore.Commerce.Plugin.Carts.PurgeCartsMinion, Sitecore.Commerce.Plugin.Carts", EnvironmentConstants.HabitatMinions, true); EngineExtensions.RunMinionWithRetry( "Sitecore.Commerce.Plugin.Carts.PurgeCartsMinion, Sitecore.Commerce.Plugin.Carts", EnvironmentConstants.AdventureWorksMinions, true); }
private static void DisassociateCatalogFromInventorySet() { using (new SampleMethodScope()) { EngineExtensions.DisassociateCatalogFromInventorySet(InventorySet1Name, Catalog1Name); EngineExtensions.AssertChildViewItemNotExists(InventorySet1Id, ChildViewNames.InventorySetSellableItems, ProductId); EngineExtensions.DisassociateCatalogFromInventorySet(InventorySet2Name, Catalog2Name); EngineExtensions.AssertChildViewItemNotExists(InventorySet2Id, ChildViewNames.InventorySetSellableItems, ProductId); } }
public static void RunScenarios() { using (new SampleScenarioScope(MethodBase.GetCurrentMethod().DeclaringType.Name)) { AddCategoryToCatalog(); AddCategoryToCategory(); EditCategory(); TryEditCategoryUsingShopsEnvironment(); EngineExtensions.DeleteCategory(ChildCategoryId); EngineExtensions.DeleteCategory(ParentCategoryId); } }
private static void AssociateSellableItemToCategory() { using (new SampleMethodScope()) { // Product1 should be a child of the catalog, but not the category. EngineExtensions.AssertChildViewItemExists(CatalogId, ChildViewNames.SellableItems, Product1Id); EngineExtensions.AssertChildViewItemNotExists(CategoryId, ChildViewNames.SellableItems, Product1Id); // Add Product1 to the category EngineExtensions.AssociateSellableItem(Product1Id, CategoryId, CategoryName, CatalogName); } }