public void UpdateMarketplaceInventoryMarketplaceProcessingErrorAndSuccessTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var products = new[] { new MarketplaceInventoryUpdateItem() { Quantity = 1, SKU = "TEST-ITEM" }, new MarketplaceInventoryUpdateItem() { Quantity = 10, SKU = "11011" } }; try { //integration.UpdateMarketplaceInventory(products); // this should throw an exception. //Assert.Fail(); } catch (AmazonUpdateInventoryException e) { Assert.AreEqual(products.Length - 1, e.ErrorResults.Count, "The number of error products is off"); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void RefundMarketplaceOrdersProcessingErrorTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var orders = new[] { new MarketplaceOrderRefund { Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234567", Items = new List <MarketplaceOrderRefundItem> { new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "123467", RefundPrice = 5.5m, QuantityCancelled = 5 }, new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "123468", RefundPrice = 3.5m, QuantityCancelled = 5 } } }, new MarketplaceOrderRefund { Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234568", Items = new List <MarketplaceOrderRefundItem> { new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "1234678", RefundPrice = 5.5m, QuantityCancelled = 5 }, new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "1234689", RefundPrice = 3.5m, QuantityCancelled = 5 } } } }; try { integration.RefundMarketplaceOrders(orders); // this should throw an exception. Assert.Fail(); } catch (AmazonOrderRefundException e) { Assert.IsTrue(orders.Length <= e.ErrorResults.Count, "The number of errors is less than the orders"); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void GetMarketplaceOrdersTestReturnsNone() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var createdAfter = DateTime.Now.AddMinutes(-2); IEnumerable<MarketplaceOrder> orders = integration.GetMarketplaceOrders(createdAfter); Assert.AreEqual(0, orders.Count()); }
public void GetMarketplaceOrdersTestReturnsNone() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var createdAfter = DateTime.Now.AddMinutes(-2); IEnumerable <MarketplaceOrder> orders = integration.GetMarketplaceOrders(createdAfter); Assert.AreEqual(0, orders.Count()); }
public void UpdateMarketplaceInventorySuccessfulTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var products = new[] { new MarketplaceInventoryUpdateItem() { Quantity = 10, SKU = "11011" } }; //integration.UpdateMarketplaceInventory(products); }
public void GetMarketplaceOrdersTestForPast3Days() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); // get the orders for the past 3 days var createdAfter = DateTime.Now.AddDays(-3); IEnumerable<MarketplaceOrder> orders = integration.GetMarketplaceOrders(createdAfter); Assert.IsTrue(orders.Count() > 0); foreach (var order in orders) { Assert.IsTrue(!string.IsNullOrWhiteSpace(order.BuyerName)); Assert.IsTrue(!string.IsNullOrWhiteSpace(order.MarketplaceOrderId)); Assert.AreEqual(EMarketplace.Amazon, order.Marketplace); Assert.AreNotEqual(EOrderStatus.Shipped, order.OrderStatus); foreach (var item in order.Items) { Assert.IsTrue(!string.IsNullOrWhiteSpace(item.MarketplaceItemId)); Assert.IsTrue(!string.IsNullOrWhiteSpace(item.MarketplaceOrderItemId)); Assert.IsTrue(!string.IsNullOrWhiteSpace(item.SKU)); } } }
public void GetMarketplaceOrdersTestForPast3Days() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); // get the orders for the past 3 days var createdAfter = DateTime.Now.AddDays(-3); IEnumerable <MarketplaceOrder> orders = integration.GetMarketplaceOrders(createdAfter); Assert.IsTrue(orders.Count() > 0); foreach (var order in orders) { Assert.IsTrue(!string.IsNullOrWhiteSpace(order.BuyerName)); Assert.IsTrue(!string.IsNullOrWhiteSpace(order.MarketplaceOrderId)); Assert.AreEqual(EMarketplace.Amazon, order.Marketplace); Assert.AreNotEqual(EOrderStatus.Shipped, order.OrderStatus); foreach (var item in order.Items) { Assert.IsTrue(!string.IsNullOrWhiteSpace(item.MarketplaceItemId)); Assert.IsTrue(!string.IsNullOrWhiteSpace(item.MarketplaceOrderItemId)); Assert.IsTrue(!string.IsNullOrWhiteSpace(item.SKU)); } } }
public void UpdateMarketplaceTrackingSuccessfulTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var order = integration.GetMarketplaceOrders(DateTime.Now.AddDays(-1)).FirstOrDefault(); var orders = new[] { new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.FedExCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = order.MarketplaceOrderId, ShippingMethod = "Express Saver", ShipperTrackingNumber = "425921896955", Items = new List <MarketplaceOrderFulfillmentItem> { new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = order.Items.First().MarketplaceOrderItemId, Quantity = order.Items.First().QuantityUnshipped } } } }; try { //integration.UpdateMarketplaceTracking(orders); // this should throw an exception. } catch (AmazonOrderFulfillmentException e) { Assert.Fail(); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void UpdateMarketplaceTrackingMarketplaceProcessingErrorTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var orders = new[] { new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.FedExCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234567", ShippingMethod = "Ground", ShipperTrackingNumber = "test tracking number", Items = new List <MarketplaceOrderFulfillmentItem> { new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123467", Quantity = 5 }, new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123468", Quantity = 5 } } }, new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.UPSCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234568", ShippingMethod = "Ground", ShipperTrackingNumber = "test tracking number", Items = new List <MarketplaceOrderFulfillmentItem> { new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123467", Quantity = 5 }, new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123468", Quantity = 5 } } }, new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.USPSCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234569", ShippingMethod = "Ground", ShipperTrackingNumber = "test tracking number", Items = new List <MarketplaceOrderFulfillmentItem> { new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123467", Quantity = 5 }, new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123468", Quantity = 5 } } } }; try { integration.UpdateMarketplaceTracking(orders); // this should throw an exception. Assert.Fail(); } catch (AmazonOrderFulfillmentException e) { Assert.IsTrue(orders.Length <= e.ErrorResults.Count, "The number of errors is less than the orders"); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void RefundMarketplaceOrdersProcessingErrorTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var orders = new[] { new MarketplaceOrderRefund { Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234567", Items = new List<MarketplaceOrderRefundItem>{ new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "123467", RefundPrice = 5.5m, QuantityCancelled = 5 }, new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "123468", RefundPrice = 3.5m, QuantityCancelled = 5 } } }, new MarketplaceOrderRefund { Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234568", Items = new List<MarketplaceOrderRefundItem>{ new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "1234678", RefundPrice = 5.5m, QuantityCancelled = 5 }, new MarketplaceOrderRefundItem { MarketplaceOrderItemId = "1234689", RefundPrice = 3.5m, QuantityCancelled = 5 } } } }; try { integration.RefundMarketplaceOrders(orders); // this should throw an exception. Assert.Fail(); } catch (AmazonOrderRefundException e) { Assert.IsTrue(orders.Length <= e.ErrorResults.Count, "The number of errors is less than the orders"); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void UpdateMarketplaceTrackingSuccessfulTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var order = integration.GetMarketplaceOrders(DateTime.Now.AddDays(-1)).FirstOrDefault(); var orders = new[] { new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.FedExCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = order.MarketplaceOrderId, ShippingMethod = "Express Saver", ShipperTrackingNumber= "425921896955", Items = new List<MarketplaceOrderFulfillmentItem>{ new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = order.Items.First().MarketplaceOrderItemId, Quantity = order.Items.First().QuantityUnshipped } } } }; try { //integration.UpdateMarketplaceTracking(orders); // this should throw an exception. } catch (AmazonOrderFulfillmentException e) { Assert.Fail(); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void UpdateMarketplaceTrackingMarketplaceProcessingErrorTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var orders = new[] { new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.FedExCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234567", ShippingMethod = "Ground", ShipperTrackingNumber= "test tracking number", Items = new List<MarketplaceOrderFulfillmentItem>{ new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123467", Quantity = 5 }, new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123468", Quantity = 5 } } }, new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.UPSCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234568", ShippingMethod = "Ground", ShipperTrackingNumber= "test tracking number", Items = new List<MarketplaceOrderFulfillmentItem>{ new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123467", Quantity = 5 }, new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123468", Quantity = 5 } } }, new MarketplaceOrderFulfillment { Carrier = new Carrier(Carrier.USPSCarrierCode), FulfillmentDate = DateTime.Now, Marketplace = EMarketplace.Amazon, MarketplaceOrderId = "1234569", ShippingMethod = "Ground", ShipperTrackingNumber= "test tracking number", Items = new List<MarketplaceOrderFulfillmentItem>{ new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123467", Quantity = 5 }, new MarketplaceOrderFulfillmentItem { MarketplaceOrderItemId = "123468", Quantity = 5 } } } }; try { integration.UpdateMarketplaceTracking(orders); // this should throw an exception. Assert.Fail(); } catch (AmazonOrderFulfillmentException e) { Assert.IsTrue(orders.Length <= e.ErrorResults.Count, "The number of errors is less than the orders"); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }
public void UpdateMarketplaceInventorySuccessfulTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var products = new[] { new MarketplaceInventoryUpdateItem() { Quantity = 10, SKU = "11011" } }; //integration.UpdateMarketplaceInventory(products); }
public void UpdateMarketplaceInventoryMarketplaceProcessingErrorTest() { IMarketplaceIntegration integration = new AmazonIntegration.AmazonIntegration(); var products = new[] { new MarketplaceInventoryUpdateItem() { Quantity = 1, SKU = "TEST-ITEM" }, new MarketplaceInventoryUpdateItem() { Quantity = 1, SKU = "TEST-ITEM2" } }; try { integration.UpdateMarketplaceInventory(products); // this should throw an exception. Assert.Fail(); } catch (AmazonUpdateInventoryException e) { Assert.AreEqual(products.Length, e.ErrorResults.Count, "The number of error products is off"); } catch (Exception e) { // no other exception should be thrown. Assert.Fail(); } }