public void ShouldGetExistingItemAdjustment() { var itemProxy = new ItemProxy(); var item = _itemHelper.GetTestInventoryItem(); var result = itemProxy.InsertItem(item); var newItem = itemProxy.GetItem(result.DataObject.InsertedItemId); var adjustmentItem = _adjustmentHelper.GetAdjustmentItem(newItem.DataObject.Id.Value, 1, newItem.DataObject.AssetAccountId.Value, 1, 1); var detail = _adjustmentHelper.GetAdjustmentDetail(new List <AdjustmentItem>() { adjustmentItem }); var adjustmentProxy = new ItemAdjustmentProxy(); var insertResponse = adjustmentProxy.InsertItemAdjustment(detail); var response = adjustmentProxy.GetItemAdjustment(insertResponse.DataObject.InsertedEntityId); Assert.IsTrue(response.IsSuccessfull); Assert.IsNotNull(response.DataObject); Assert.IsTrue(response.DataObject.Id == insertResponse.DataObject.InsertedEntityId); }
private static bool TryProcessItemMetadata(string segment, [NotNull] ItemProxy proxy) { if (Item.Quality && Data.Qualities.TryGetValue(segment, out QualityCategory quality)) { proxy.Quality = quality; return(true); } if (Item.Stuff) { proxy.Stuff = GetItemRaw(segment); } if (proxy.Stuff != null || proxy.Quality.HasValue) { return(true); } proxy.ProcessError = true; return(false); }
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); }
public void ShouldInsertItemAdjustment() { //var itemCode = "test_w1"; var itemProxy = new ItemProxy(); var item = _itemHelper.GetTestInventoryItem(); var result = itemProxy.InsertItem(item); var newItem = itemProxy.GetItem(result.DataObject.InsertedItemId); var adjustmentItem = _adjustmentHelper.GetAdjustmentItem(newItem.DataObject.Id.Value, 1, newItem.DataObject.AssetAccountId.Value, 1, 1); var detail = _adjustmentHelper.GetAdjustmentDetail(new List <AdjustmentItem>() { adjustmentItem }); var adjustmentProxy = new ItemAdjustmentProxy(); var response = adjustmentProxy.InsertItemAdjustment(detail); Assert.IsTrue(response.IsSuccessfull); Assert.IsNotNull(response.DataObject); Assert.IsTrue(response.DataObject.InsertedEntityId > 0); Assert.GreaterOrEqual(response.DataObject.UtcLastModified, DateTime.Today.AddMinutes(-10).ToUniversalTime()); }
protected virtual void AdjustSellIn(ItemProxy item) { item.DecreaseSellIn(); }
protected override void AdjustSellIn(ItemProxy item) { // Do nothing }
public override void AdjustQualityForNegativeSellIn(ItemProxy item) { item.ResetQuality(); }
protected override void AdjustQualityAfterSellInDate(ItemProxy item) { item.DecreaseQuality(); item.DecreaseQuality(); }
public override bool IsMatch(ItemProxy item) { // default rule return(true); }
public override bool IsMatch(ItemProxy item) { return(item.Name == "Conjured Mana Cake"); }
public override void AdjustQualityForNegativeSellIn(ItemProxy item) { item.DecrementQuality(); item.DecrementQuality(); }
protected override void AdjustQualityAfterSellInDate(ItemProxy item) { item.ResetQuality(); }
private void CreateTestInventoryItems() { var proxy = new ItemProxy(); //sale items. if (_InventorySaleItemId == 0) { var result = proxy.InsertItem(new ItemDetail() { AssetAccountId = _AssetAccountId, BuyingPrice = new decimal(4.00), Code = string.Format("Inv{0}", Guid.NewGuid().ToString().Substring(0, 20)), CurrentValue = new decimal(6.00), DefaultReOrderQuantity = 2, Description = "Test inventory sale item", IsActive = true, IsBought = false, IsBuyingPriceIncTax = false, IsSold = true, SaleIncomeAccountId = _IncomeAccountId, Type = "I", }); _InventorySaleItemId = result.DataObject.InsertedItemId; } if (_InventorySaleItemId2 == 0) { var result = proxy.InsertItem(new ItemDetail() { AssetAccountId = _AssetAccountId, BuyingPrice = new decimal(40.00), Code = string.Format("Inv{0}", Guid.NewGuid().ToString().Substring(0, 20)), CurrentValue = new decimal(16.00), DefaultReOrderQuantity = 20, Description = "updated Test inventory sale item", IsActive = true, IsBought = false, IsBuyingPriceIncTax = false, IsSold = true, SaleIncomeAccountId = _IncomeAccountId2, Type = "I", }); _InventorySaleItemId2 = result.DataObject.InsertedItemId; } //purchase items. if (_InventoryPurchaseItemId == 0) { var result = proxy.InsertItem(new ItemDetail() { AssetAccountId = _AssetAccountId, BuyingPrice = new decimal(4.00), Code = string.Format("Inv{0}", Guid.NewGuid().ToString().Substring(0, 20)), CurrentValue = new decimal(6.00), DefaultReOrderQuantity = 2, Description = "Test inventory purchase item", IsActive = true, IsBought = true, IsBuyingPriceIncTax = true, PurchaseExpenseAccountId = _ExpenseAccountId, Type = "I", }); _InventoryPurchaseItemId = result.DataObject.InsertedItemId; } if (_InventoryPurchaseItemId2 == 0) { var result = proxy.InsertItem(new ItemDetail() { AssetAccountId = _AssetAccountId, BuyingPrice = new decimal(40.00), Code = string.Format("Inv{0}", Guid.NewGuid().ToString().Substring(0, 20)), CurrentValue = new decimal(60.00), DefaultReOrderQuantity = 20, Description = "Updated test inventory purchase item", IsActive = true, IsBought = true, IsBuyingPriceIncTax = true, PurchaseExpenseAccountId = _ExpenseAccountId2, Type = "I", }); _InventoryPurchaseItemId2 = result.DataObject.InsertedItemId; } }
protected override void AdjustQualityAfterSellInDate(ItemProxy item) { // Do nothing }
protected abstract void AdjustQualityAfterSellInDate(ItemProxy item);
public override bool IsMatch(ItemProxy item) { return(item.Name == "Aged Brie"); }
public bool TryGetNextAsItem(out ItemProxy item) { item = GetNextAsItem(); return(!(item is null)); }
public override void AdjustSellIn(ItemProxy item) { // do nothing }
public override void AdjustQualityForNegativeSellIn(ItemProxy item) { // do nothing }
public override void AdjustQuality(ItemProxy item) { item.DecrementQuality(); }
public override bool IsMatch(ItemProxy item) { return(item.Name == "Sulfuras, Hand of Ragnaros"); }
protected override void AdjustQuality(ItemProxy item) { item.DecreaseQuality(); item.DecreaseQuality(); }
public override void AdjustQuality(ItemProxy item) { // do nothing }
public void UpdateQuality(ItemProxy item) { switch (item.Name) { case "Aged Brie": item.IncrementQuality(); if (item.SellIn <= 0) { item.IncrementQuality(); } item.DecreaseSellIn(); break; case "Sulfuras, Hand of Ragnaros": break; case "Backstage passes to a TAFKAL80ETC concert": item.IncrementQuality(); if (item.SellIn <= 10) { item.IncrementQuality(); } if (item.SellIn <= 5) { item.IncrementQuality(); } if (item.SellIn <= 0) { item.ResetQuality(); } item.DecreaseSellIn(); break; case "Conjured hat": item.DecreaseQuality(); item.DecreaseQuality(); if (item.SellIn <= 0) { item.DecreaseQuality(); item.DecreaseQuality(); } item.DecreaseSellIn(); break; default: item.DecreaseQuality(); if (item.SellIn <= 0) { item.DecreaseQuality(); } item.DecreaseSellIn(); break; } }
protected abstract void AdjustQuality(ItemProxy item);
public override bool IsMatch(ItemProxy item) { return(item.Name == "Backstage passes to a TAFKAL80ETC concert"); }
protected override void AdjustQuality(ItemProxy item) { // Do nothing }