コード例 #1
0
        public void GetInventoryAndComboItems()
        {
            var itemsProxy = new ItemsProxy();
            var inventoryAndComboItemResponse = itemsProxy.GetItems(null, null, null, 0, 100);

            Assert.IsTrue(inventoryAndComboItemResponse.IsSuccessfull, "Unsuccessful request.");
            var inventoryAndComboItemResult = inventoryAndComboItemResponse.DataObject;

            Assert.IsNotNull(inventoryAndComboItemResult, "Could not retrieve inventory and combo items successfully.");
            if (inventoryAndComboItemResult.Items.Count > 0)
            {
                Assert.IsTrue(inventoryAndComboItemResult.Items.Find(i => i.Type == "I") != null, "There were no inventory items found.");
                Assert.IsTrue(inventoryAndComboItemResult.Items.Find(c => c.Type == "C") != null, "There were no combo items found.");
            }

            var item = inventoryAndComboItemResult.Items.First();
            Assert.IsTrue(item.LastModifiedDateUtc.HasValue);
            Assert.AreNotEqual(DateTime.MinValue, item.LastModifiedDateUtc.Value);
            Assert.IsTrue(item.CreatedDateUtc.HasValue);
            Assert.AreNotEqual(DateTime.MinValue, item.CreatedDateUtc.Value);
        }
コード例 #2
0
        public void GetInventoryItemById()
        {
            var itemsProxy = new ItemsProxy();
            var inventoryAndComboItemResponse = itemsProxy.GetItems("I", null, null, 0, 25);
            Assert.IsTrue(inventoryAndComboItemResponse.IsSuccessfull && inventoryAndComboItemResponse.DataObject.Items.Count > 0, "Cannot continue test, request for items failed or returned no items");

            var existingInventoryItemId = inventoryAndComboItemResponse.DataObject.Items.First().Id;

            var itemProxy = new ItemProxy();
            var inventoryItemResponse = itemProxy.GetItem(existingInventoryItemId.Value);

            Assert.IsTrue(inventoryItemResponse.IsSuccessfull, "Unsuccessful request.");
            var inventoryItem = inventoryItemResponse.DataObject;

            Assert.IsNotNull(inventoryItem, "No inventory item found.");
            Assert.IsTrue(inventoryItem.Type == "I", "Invalid item type.");

            Assert.IsTrue(inventoryItem.LastModifiedDateUtc.HasValue);
            Assert.AreNotEqual(DateTime.MinValue, inventoryItem.LastModifiedDateUtc.Value);
            Assert.IsTrue(inventoryItem.CreatedDateUtc.HasValue);
            Assert.AreNotEqual(DateTime.MinValue, inventoryItem.CreatedDateUtc.Value);
        }
コード例 #3
0
        public void GetOnlyComboItems()
        {
            var itemsProxy = new ItemsProxy();
            var inventoryAndComboItemResponse = itemsProxy.GetItems("C", null, null, 0, 25);

            Assert.IsTrue(inventoryAndComboItemResponse.IsSuccessfull, "Unsuccessful request.");
            var inventoryAndComboItemResult = inventoryAndComboItemResponse.DataObject;

            Assert.IsNotNull(inventoryAndComboItemResult, "Could not retireve inventory items successfully.");
            if (inventoryAndComboItemResult.Items.Count > 0)
            {
                Assert.IsTrue(inventoryAndComboItemResult.Items.Find(i => i.Type == "I") == null, "Inventory items should not have been returned.");
            }
        }