コード例 #1
0
        public void Given_Region_Is_OutofStock_When_Applying_Stock_Changes_Due_To_ITL_Notifications_Should_Return_A_Stock_Status_Not_Equal_To_OutofStock()
        {
            // Arrange
            var regionStock             = new RegionStockItem("UK", 0, new RegionStockItemStatus(10, StockStatus.OutOfStock), new List <WarehouseAvailableStockItem>(), DateTime.UtcNow);
            var warehouseAvailableStock = new WarehouseAvailableStockItem("FC01", "123", 10, 0, 0, DateTime.Now);

            // Act
            regionStock.ApplyStockChanges(warehouseAvailableStock);

            // Assert
            Assert.AreEqual(regionStock.Status.Value, StockStatus.InStock);
            Assert.AreEqual(regionStock.Quantity, 10);
            Assert.AreEqual(regionStock.Version, warehouseAvailableStock.Version);
        }
コード例 #2
0
        public void Given_Region_Is_InStock_When_Applying_Low_In_Stock_StockChange_Should_Return_A_Stock_Status_Is_Equal_To_Low_In_Stock()
        {
            // Arrange
            var regionStock = new RegionStockItem("UK", 10, new RegionStockItemStatus(10, StockStatus.InStock), new List <WarehouseAvailableStockItem> {
                new WarehouseAvailableStockItem("FC01", "123", 10, 0, 0, DateTime.UtcNow)
            }, DateTime.UtcNow);
            var warehouseAvailableStock = new WarehouseAvailableStockItem("FC01", "123", 9, 1, 0, DateTime.Now);

            // Act
            regionStock.ApplyStockChanges(warehouseAvailableStock);

            // Assert
            Assert.AreEqual(regionStock.Status.Value, StockStatus.LowInStock);
            Assert.AreEqual(regionStock.Quantity, 9);
            Assert.AreEqual(regionStock.Version, warehouseAvailableStock.Version);
        }