public void ShouldGetTrackingNumberandCost() { //Arrange var shippingStationOrder = new ShipStationOrders(); Task <int> resultTask; //Act resultTask = shippingStationOrder.PostTrackingNumberAndCost(); resultTask.Wait(); var result = resultTask.Result; //Assert Assert.True(result > 0); }
private static void ExecuteMainProcess() { Console.Title = ConfigurationManager.AppSettings["AppName"].ToString(); Console.WriteLine("Enter the start date of fetching the orders (yyyy-mm-dd)."); var dateStr = Console.ReadLine(); DateTime orderCreatedAfter = DateTime.Now.Date; if (!string.IsNullOrEmpty(dateStr)) { orderCreatedAfter = Convert.ToDateTime(dateStr); } Console.WriteLine("Starting the MWS Orders server..."); var ordersManager = initMarketplaceManager(); var inventoryManager = new ProductInventoryManager(); bool isKeepRunning = true; while (isKeepRunning) { Console.WriteLine("Fetch the orders from marketplaces and insert them to the database..."); // fetch the orders from marketplaces and insert them to the database var orders = ordersManager.DownloadMarketplaceOrders(orderCreatedAfter.AddHours(-3)); Console.WriteLine("Let's do the product inventory update based on the orders..."); // let's do the vendor product inventory update based on the orders inventoryManager.UpdateOrderVendorProductInventory(orders); Console.WriteLine("Starting to post unshipped orders to ShipStation..."); // post unshipped orders to ShipStation using (var shippingStationOrder = new ShipStationOrders()) { var result_task = shippingStationOrder.PostOrderToShippingStation(); result_task.Wait(); var result = result_task.Result; //result returns the number of unshipped orders posted Console.WriteLine("Done posting unshipped orders to ShipStation."); Console.WriteLine("Total items posted to ShipStation: " + result.ToString()); // get track number and cost Console.WriteLine("Starting to get tracking number and cost from ShipStation..."); result_task = shippingStationOrder.PostTrackingNumberAndCost(); result = result_task.Result; Console.WriteLine("Done retreving shipment data from ShipStation."); Console.WriteLine("Total items acquired from ShipStation: " + result.ToString()); } // send confirm shipment to all orders ordersManager.ConfirmOrdersShipment(); // let's sleep for 1 minutes Console.WriteLine("The program goes to sleep for 1 minute..."); Thread.Sleep(60000); // let's set the orderCreated to today's date orderCreatedAfter = DateTime.UtcNow.Date; } Console.WriteLine("MWS Orders manager server end."); Console.ReadKey(true); }