private static void GetRawEntity() { Console.WriteLine("Begin GetRawEntity"); var devOps = new DevOpAndre(); var container = devOps.Context.OpsContainer(); Action action = null; try { action = () => Proxy.GetValue(container.GetRawEntity("invalidEntityId", "HabitatShops")); } catch (DataServiceClientException) { action?.ShouldThrow <DataServiceClientException>(); } var result = Proxy.GetValue(container.GetRawEntity("Entity-SellableItem-AW007 08", "AdventureWorksShops")); result.Should().NotBeNull(); try { action = () => Proxy.GetValue(container.GetRawEntity($"Environments/{devOps.Context.Environment}", "HabitatShops")); } catch (DataServiceClientException) { action?.ShouldThrow <DataServiceClientException>(); } }
public static void RunScenarios() { var watch = new Stopwatch(); watch.Start(); var devOp = new DevOpAndre(); var container = devOp.Context.OpsContainer(); Console.WriteLine("---------------------------------------------------"); Bootstrap(container); CleanEnvironment(container, "AdventureWorksAuthoring"); CleanEnvironment(container, "HabitatAuthoring"); InitializeEnvironment(container, "AdventureWorksAuthoring"); InitializeEnvironment(container, "HabitatAuthoring"); Console.WriteLine("---------------------------------------------------"); GetPipelines(container); Console.WriteLine("---------------------------------------------------"); watch.Stop(); Console.WriteLine($"End Bootstrapping: {watch.ElapsedMilliseconds} ms"); }
public static void RunScenarios() { using (new SampleScenarioScope("Content")) { var devOp = new DevOpAndre(); var container = devOp.Context.OpsContainer(); EnsureSyncDefaultContentPaths(container, "AdventureWorksAuthoring", devOp.Context.Shop); EnsureSyncDefaultContentPaths(container, "HabitatAuthoring", devOp.Context.Shop); } }
public static void RunScenarios() { using (new SampleScenarioScope("Bootstrapping")) { var container = new DevOpAndre { Context = { Environment = "GlobalEnvironment" } }.Context.OpsContainer(); Bootstrap(container); CleanEnvironment(container, "AdventureWorksAuthoring"); CleanEnvironment(container, "HabitatAuthoring"); InitializeEnvironment(container, "AdventureWorksAuthoring"); InitializeEnvironment(container, "HabitatAuthoring"); GetPipelines(container); } }
public static void RunScenarios() { var watch = new Stopwatch(); watch.Start(); Console.WriteLine("Begin Content"); var devOp = new DevOpAndre(); var container = devOp.Context.OpsContainer(); Console.WriteLine("---------------------------------------------------"); EnsureSyncDefaultContentPaths(container, "AdventureWorksAuthoring", devOp.Context.Shop); EnsureSyncDefaultContentPaths(container, "HabitatAuthoring", devOp.Context.Shop); Console.WriteLine("---------------------------------------------------"); watch.Stop(); Console.WriteLine($"End Content: {watch.ElapsedMilliseconds} ms"); }
private static void GetRawEntity() { using (new SampleMethodScope()) { var devOps = new DevOpAndre(); var container = devOps.Context.OpsContainer(); Proxy.GetValue(container.GetRawEntity("invalidEntityId", "uid", EnvironmentConstants.HabitatShops)); var uniqueId = Proxy.GetValue( container.GetDeterministicEntityUniqueId("Entity-SellableItem-AW007 08", 1)); uniqueId.Should().NotBe(Guid.Empty); var result = Proxy.GetValue( container.GetRawEntity("Entity-SellableItem-AW007 08", uniqueId.ToString(), EnvironmentConstants.AdventureWorksShops)); result.Should().NotBeNull(); Proxy.GetValue( container.GetRawEntity( $"Environments/{devOps.Context.Environment}", string.Empty, EnvironmentConstants.HabitatShops)); } }
public static void RunScenarios() { var value = Settings.Default.RequestedTestRuns; _requestedTestRuns = value; var opsUser = new DevOpAndre(); Randomizer.Seed = new Random(3897234); // Set the randomizer seed if you wish to generate repeatable data sets. var testParties = new Faker <Party>() .RuleFor(u => u.FirstName, f => f.Name.FirstName()) .RuleFor(u => u.LastName, f => f.Name.LastName()) .RuleFor(u => u.Email, (f, u) => f.Internet.Email(u.FirstName, u.LastName)) .RuleFor(u => u.AddressName, f => "FulfillmentPartyName") .RuleFor(u => u.Address1, f => f.Address.StreetAddress(true)) .RuleFor(u => u.City, f => f.Address.City()) .RuleFor(u => u.StateCode, f => "WA") .RuleFor(u => u.State, f => "Washington") .RuleFor(u => u.ZipPostalCode, f => "93612") .RuleFor(u => u.CountryCode, f => "US") .RuleFor(u => u.Country, f => "United States") .FinishWith((f, u) => { System.Console.WriteLine($"BogusUser Address1={u.Address1}|City={u.City}"); }); using (new SampleScenarioScope("Orders")) { System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("---------------------------------------------------"); System.Console.WriteLine($"Requested Runs: {_requestedTestRuns}"); System.Console.WriteLine("---------------------------------------------------"); System.Console.ForegroundColor = ConsoleColor.Cyan; for (var i = 1; i <= _requestedTestRuns; i++) { try { //Anonymous Customer Jeff Order Samples var bogusParty = testParties.Generate(); var jeff = new AnonymousCustomerJeff(); jeff.Context.Components.OfType <ElectronicFulfillmentComponent>().First().EmailAddress = bogusParty.Email; var physicalFulfillmentComponent = jeff.Context.Components .OfType <PhysicalFulfillmentComponent>() .FirstOrDefault(); if (physicalFulfillmentComponent != null) { physicalFulfillmentComponent.ShippingParty = bogusParty; } var danaHab = new RegisteredHabitatCustomerDana(); bogusParty = testParties.Generate(); danaHab.Context.Components.OfType <ElectronicFulfillmentComponent>().First().EmailAddress = bogusParty.Email; physicalFulfillmentComponent = danaHab.Context.Components.OfType <PhysicalFulfillmentComponent>() .FirstOrDefault(); if (physicalFulfillmentComponent != null) { physicalFulfillmentComponent.ShippingParty = bogusParty; } danaHab.Context.CustomerId = AddCustomer( danaHab.Context.Components.OfType <ElectronicFulfillmentComponent>().First().EmailAddress, danaHab.Context, bogusParty.FirstName, bogusParty.LastName); // RegisteredCustomer Dana Order Samples var danaAdv = new RegisteredCustomerDana(); bogusParty = testParties.Generate(); danaAdv.Context.Components.OfType <ElectronicFulfillmentComponent>().First().EmailAddress = bogusParty.Email; danaAdv.Context.CustomerId = AddCustomer( danaAdv.Context.Components.OfType <ElectronicFulfillmentComponent>().First().EmailAddress, danaAdv.Context, bogusParty.FirstName, bogusParty.LastName); var lastSimplePhysical = SimplePhysical2Items.Run(jeff.Context); var lastGiftCardOrder = BuyGiftCards.Run(jeff.Context); _createdGiftCard = jeff.Context.GiftCards.First(); var lastBuyWithGiftCard = BuyWithGiftCard.Run(jeff.Context); SimplePhysicalRtrn15Coupon.Run(jeff.Context); AddRemovePayment.Run(jeff.Context); AddRemoveCoupon.Run(jeff.Context); UseLimitedCouponMoreThanOnce.Run(jeff.Context); OnSaleItem.Run(jeff.Context); BuyBackOrderedItem.Run(jeff.Context); BuyPreOrderableItem.Run(jeff.Context); BuyAvailabilitySplitItem.Run(jeff.Context); AddRemoveCartLine.Run(jeff.Context); var lastSplitShipment = BuySplitShipment.Run(jeff.Context); ////International var katrina = new InternationalShopperKatrina(); var result = Proxy.GetValue( katrina.Context.ShopsContainer() .SellableItems.ByKey("Adventure Works Catalog,AW055 01,33") .Expand( "Components($expand=ChildComponents($expand=ChildComponents($expand=ChildComponents)))")); result.Should().NotBeNull(); result.ListPrice.CurrencyCode.Should().Be("EUR"); result.ListPrice.Amount.Should().Be(1.0M); ////These samples leverage EntityViews and EntityActions ////For post order management ////Place a Split shipment order and then put it on hold SplitShipmentOnHold.Run(jeff.Context); ////Place a Split shipment order, place it on hold and delete one of the lines SplitShipmentThenDeleteLine.Run(jeff.Context); ////Retrieve the Business User "View" for the SplitShipment end order. The Order should still be in a Pending State Proxy.GetValue( jeff.Context.ShopsContainer() .GetEntityView(lastSplitShipment, "Master", string.Empty, string.Empty)); var cancelOrderId = Buy3Items.Run(jeff.Context); if (!string.IsNullOrEmpty(cancelOrderId)) { CancelOrder(cancelOrderId); } ////RegisteredCustomer Dana Order Samples SimplePhysical2Items.Run(danaAdv.Context); BuyGiftCards.Run(danaAdv.Context); BuyWarranty.Run(danaHab.Context, 1); danaHab.GoShopping(); //Force the pending orders Minion to run RunPendingOrdersMinion(opsUser.Context); //Force the Released Orders Minion to run RunReleasedOrdersMinion(opsUser.Context); //The Following represent examples of using the Business User (BizOps) Api to handle Orders. //At this stage, the orders have been released and only actions allowed on Released or Problem orders can occur //Get the last SimplePhysical order to show how it is changed by the Minions var orderMaster = Proxy.GetEntityView( jeff.Context.ShopsContainer(), lastSimplePhysical, "Master", string.Empty, string.Empty); if (!orderMaster.ChildViews.Any(p => p.Name.EqualsIgnoreCase("Shipments"))) { ConsoleExtensions.WriteErrorLine($"LastSimplePhysical.MissingShipments: OrderId={lastSimplePhysical}"); } ////Get the last SimplePhysical order to show how it is changed by the Minions var lastGiftCardMaster = Proxy.GetEntityView( jeff.Context.ShopsContainer(), lastGiftCardOrder, "Master", string.Empty, string.Empty); ////There should not be a Shipments child EntityView because this was a Digital order lastGiftCardMaster.ChildViews.Count(p => p.Name == "Shipments").Should().Be(0); var giftCardNew = jeff.Context.ShopsContainer() .GiftCards.ByKey("Entity-GiftCard-" + _createdGiftCard) .Expand("Components($expand=ChildComponents)") .GetValue() as GiftCard; giftCardNew.Should().NotBeNull(); var lastBuyWithGiftCardView = Proxy.GetEntityView( jeff.Context.ShopsContainer(), lastBuyWithGiftCard, "Master", string.Empty, string.Empty); var salesActivities = lastBuyWithGiftCardView.ChildViews.First(p => p.Name == "SalesActivities") as EntityView; salesActivities.ChildViews.Count.Should().Be(2); // Example of updating the Order Status from via a service. This is for external systems to push status updates SetOrderStatus(); } catch (Exception ex) { ConsoleExtensions.WriteColoredLine(ConsoleColor.Red, $"Test Exception - {ex.Message}"); ConsoleExtensions.WriteColoredLine(ConsoleColor.Red, $"Test Exception - {ex.StackTrace}"); } System.Console.ForegroundColor = ConsoleColor.Cyan; System.Console.WriteLine("---------------------------------------------------"); System.Console.WriteLine($"Test pass {i} of {_requestedTestRuns}"); System.Console.WriteLine($"Orders:{_totalOrders} Dollars:{_totalOrderDollars}"); System.Console.ForegroundColor = ConsoleColor.Cyan; } } }