/// <summary> /// Delete a Batch /// </summary> /// <param name="client">OloClient</param> /// <param name="testContext">TestContext</param> /// <param name="batchId">(sic)</param> public static void DeleteBatch(OloClient client, TestContext testContext, int batchId) { var path = string.Format("/v1.1/orderexports/{0}", batchId); client.Delete(path, null); string oeText = client.GetJsonAsString("/v1.1/orderexports", null); testContext.WriteLine("Order Exports:\n{0}", oeText); var list = JsonConvert.DeserializeObject <OrderExportList>(oeText); if ((list.batches == null) || (list.batches.Count <= 0)) { Assert.Inconclusive("No Test Data Fetched"); } var b = list.batches.AsQueryable().Where(p => p.batchId == batchId).FirstOrDefault(); Assert.IsNull(b, "Should be missing"); }
/// <summary> /// Get Batch List /// </summary> /// <param name="client">OloClient</param> /// <param name="testContext">(sic)</param> /// <returns>Last Batch Id</returns> public static int GetList(OloClient client, TestContext testContext) { var lastBatchId = 0; string oeText = client.GetJsonAsString("/v1.1/orderexports", null); testContext.WriteLine("Order Exports:\n{0}", oeText); var list = JsonConvert.DeserializeObject <OrderExportList>(oeText); if ((list.batches == null) || (list.batches.Count <= 0)) { Assert.Inconclusive("No Test Data Fetched"); } lastBatchId = list.batches[0].batchId; testContext.WriteLine("Last Batch Id: {0}", lastBatchId); Assert.IsTrue(lastBatchId > 0, "Batch Id Should Be > 0"); return(lastBatchId); }