Exemplo n.º 1
0
        public void DecrementStock()
        {
            Item item = ItemTestBuilder.AnItem()
                        .WithAmountOfStock(10)
                        .Build();

            item.DecrementStock(8);

            Assert.Equal(2, item.AmountOfStock);
        }
Exemplo n.º 2
0
        public void DecrementStock_givenHigherAmountToDecrementThanActualRemainingStock_thenThrowException()
        {
            Guid itemId = Guid.NewGuid();
            Item item   = ItemTestBuilder.AnItem()
                          .WithId(itemId)
                          .WithAmountOfStock(7)
                          .Build();

            Exception ex = Assert.Throws <Exception>(() => item.DecrementStock(8));

            Assert.Equal("Decrementing the stock amount of an item " + itemId.ToString("N") + " below 0 is not allowed", ex.Message);
        }
Exemplo n.º 3
0
        public void getStockUrgency_givenAmountOfStockHigherThan10_thenHighStockUrgency()
        {
            Item item = ItemTestBuilder.AnItem().WithAmountOfStock(11).Build();

            Assert.Equal(Item.StockUrgency.STOCK_HIGH, item.GetStockUrgency());
        }
Exemplo n.º 4
0
        public void getStockUrgency_givenAmountOfStockLowerThan10_thenMediumStockUrgency()
        {
            Item item = ItemTestBuilder.AnItem().WithAmountOfStock(7).Build();

            Assert.Equal(Item.StockUrgency.STOCK_MEDIUM, item.GetStockUrgency());
        }
Exemplo n.º 5
0
        public void GetStockUrgency_givenAmountOfStockLowerThan5_thenLowStockUrgency()
        {
            Item item = ItemTestBuilder.AnItem().WithAmountOfStock(4).Build();

            Assert.Equal(Item.StockUrgency.STOCK_LOW, item.GetStockUrgency());
        }