Created
March 19, 2019 11:01
-
-
Save lukepuplett/163b5677103e1e3a5c9d363a72beb9e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
private static string baseAddress = "http://localhost:5000/api"; | |
static async System.Threading.Tasks.Task Main(string[] args) | |
{ | |
var journey = new JourneyBuilder(new Uri(args.FirstOrDefault() ?? baseAddress)); | |
var discountDetails = new AddDiscountForm() | |
{ | |
promotionId = 123456, | |
discountType = "Promotion", | |
discount = UnitValue.FromFloat(14.00) | |
}; | |
var employerDetails = new EmployerDetailsForm() | |
{ | |
name = "Microsoft" | |
}; | |
var productSearch = new ProductSearchForm() | |
{ | |
barcode = "234h5j332kl4jn5b" | |
}; | |
await journey | |
.SelectRoot() | |
.SelectRelation("product-finder", new { barcode = "23409-23097" }) | |
.SelectItem(0) | |
.SelectRelation("add-discount", discountDetails) | |
.RunAsync(); | |
await journey | |
.SelectRoot() | |
.SelectRelation("sale-finder", new { saleId = 123 }) | |
.SelectItem(0) | |
.SelectRelation("payment-details") | |
.Read("methodName", out IDictionary<string, string> keyValues) | |
.Read("cardNumber", keyValues) | |
.RunAsync(); | |
await journey | |
.SelectRoot() | |
.SelectRelation("customer-finder", new { quoteId = 123 }) | |
.SelectItem(0) | |
.SelectRelation("profession") | |
.SelectRelation("set-employer", employerDetails) | |
.RunAsync(); | |
await journey | |
.SelectRoot() | |
.SelectRelation("quote-finder", new { quoteId = 123 }) | |
.SelectItem(0) | |
.SelectRelation("vehicles") | |
.SelectItem<VehicleItem>(v => v.Drivers.Any(d => d.age < 25)) | |
.SelectRelation("add-surcharge", new { amount = 21.50 , currency = "GBP" }) | |
.RunAsync(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment