Пример #1
0
        public async void When_FullDepreciationIsApplied_Expect_CurrentPriceEqualsOne(int id)
        {
            var item = await _inventoryItemRepository.GetById(id);

            var category = await _inventoryCategoryRepository.GetById(item.InventoryCategoryId);

            var lifeExpectancyInDays = _timeService.ConvertYearsToDays((int)category.Deprecation);

            for (int i = 0; i < lifeExpectancyInDays; i++)
            {
                await _backgroundInventoryUpdater.ApplyDepreciationToInventoryItems();
            }

            var itemAfterFullDepreciation = await _inventoryItemRepository.GetById(id);

            var priceAfterFullDepreciation = Math.Round(itemAfterFullDepreciation.CurrentPrice);

            Assert.True(priceAfterFullDepreciation == 1, "Failed to apply full depreciation.");
        }
Пример #2
0
        public void EditInventoryCategory(InventoryCategory inventoryCategory)
        {
            var original = inventoryCategoryRepository.GetById(s => s.CategoryId == inventoryCategory.CategoryId);

            inventoryCategoryRepository.Update(original, inventoryCategory.AutoMapObject <InventoryCategory, InventoriesCategory>());
        }