Example #1
0
        private void CreateTestItems()
        {
            //Create Item.
            var item     = _itemHelper.GetTestInventoryItem();
            var proxy    = new ItemProxy();
            var response = new ItemProxy().InsertItem(item);

            _item = proxy.GetItem(response.DataObject.InsertedItemId).DataObject;

            //set SOH for item.
            var adjustment = new Core.Models.ItemAdjustments.AdjustmentDetail
            {
                AdjustmentItems = new List <Core.Models.ItemAdjustments.AdjustmentItem>
                {
                    new Core.Models.ItemAdjustments.AdjustmentItem
                    {
                        ItemId     = (int)_item.Id,
                        AccountId  = (int)item.AssetAccountId,
                        Quantity   = 20,
                        UnitPrice  = (decimal)item.BuyingPrice,
                        TotalPrice = (20 * (decimal)item.BuyingPrice)
                    }
                },
                Date = DateTime.Now
            };

            //Insert adjustment so there is enough Stock on hand for tests.
            var adjustmentResponse = new ItemAdjustmentProxy().InsertItemAdjustment(adjustment);
        }
Example #2
0
        private void CreateItems()
        {
            var proxy  = new ItemProxy();
            var helper = new ItemHelper();

            var inventoryItem1 = helper.GetTestInventoryItem();
            var inventoryItem2 = helper.GetTestInventoryItem();

            //Create items.
            var result = proxy.InsertItem(inventoryItem1);

            _DeletedItemId = result.DataObject.InsertedItemId;

            result            = proxy.InsertItem(inventoryItem2);
            _NotDeletedItemId = result.DataObject.InsertedItemId;

            //Delete only first item.
            proxy.DeleteItem(_DeletedItemId);
        }
Example #3
0
        private ItemDetail InsertAndGetInventoryItem()
        {
            var itemProxy     = new ItemProxy();
            var inventoryItem = _itemHelper.GetTestInventoryItem();
            var itemResponse  = itemProxy.InsertItem(inventoryItem);
            var item          = itemProxy.GetItem(itemResponse.DataObject.InsertedItemId);

            Assert.IsNotNull(item.DataObject, "Failed to insert and retrieve inventory item");
            Thread.Sleep(2000);
            return(item.DataObject);
        }
Example #4
0
        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());
        }