コード例 #1
0
        public void Should_correctly_determine_refrigeratedness_for_each_lorry_type(string lorryType, bool expectedRefrigeratedness)
        {
            // Act
            bool refrigeratedness = new Warehouse().IsLorryRefrigerated(lorryType);

            // Assert
            Assert.AreEqual(expectedRefrigeratedness, refrigeratedness);
        }
コード例 #2
0
        public void When_ten_or_fewer_B_items_are_ordered_Then_one_B_pallet_is_needed(int numItems)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock("B", numItems);

            // Assert
            Assert.AreEqual(warehouse.ReconcileOrders()[0].Consignment, new string[] { "B" });
        }
コード例 #3
0
        public void When_only_B_items_are_ordered_Then_all_pallets_should_be_B_pallets()
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock("B", 100);

            // Assert
            Assert.IsTrue(warehouse.ReconcileOrders()[0].Consignment.ToList().All(x => x == "B"));
        }
コード例 #4
0
        public void When_B_items_are_ordered_Then_the_number_of_pallets_is_one_pallet_for_every_ten_items_or_fewer(int numItems, int numExpectedPallets)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock("B", numItems);

            // Assert
            Assert.AreEqual(warehouse.ReconcileOrders()[0].Consignment.Length, numExpectedPallets);
        }
コード例 #5
0
        public void When_between_11_and_20_B_items_are_ordered_Then_two_B_Pallets_are_needed(int numItems)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock("B", numItems);

            // Assert
            Assert.AreEqual(new string[] { "B", "B" }, warehouse.ReconcileOrders()[0].Consignment);
        }
コード例 #6
0
        public void When_small_quantity_of_stock_is_refrigerated_then_refrigerated_lorry_is_used(string stockCode)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock(stockCode, 5);
            List<DispatchRequest> dispatchRequests = warehouse.ReconcileOrders();

            // Assert
            Assert.AreEqual(true, warehouse.IsLorryRefrigerated(dispatchRequests[0].LorryType));
        }
コード例 #7
0
        public void When_small_quantity_of_stock_is_refrigerated_then_modified_transit_is_used(string stockCode)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock(stockCode, 5);
            List<DispatchRequest> dispatchRequests = warehouse.ReconcileOrders();

            // Assert
            Assert.AreEqual("Modified Transit", dispatchRequests[0].LorryType);
        }
コード例 #8
0
        public void When_some_stock_is_refrigerated_and_some_is_not_for_large_order_Then_lorry_is_used(string stockCode)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock("C", 5);
            warehouse.OrderStock(stockCode, 50);
            List<DispatchRequest> dispatchRequests = warehouse.ReconcileOrders();

            // Assert
            Assert.AreEqual("Lorry", dispatchRequests[0].LorryType);
        }
コード例 #9
0
        public void When_stock_is_not_refrigerated_for_small_order_Then_transit_is_used(string stockCode)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock(stockCode, 6);
            List<DispatchRequest> dispatchRequests = warehouse.ReconcileOrders();

            // Assert
            Assert.AreEqual("Transit", dispatchRequests[0].LorryType);
        }
コード例 #10
0
        public void When_stock_is_not_refrigerated_for_large_order_Then_non_refrigerated_lorry_is_used(string stockCode)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock(stockCode, 300);
            List<DispatchRequest> dispatchRequests = warehouse.ReconcileOrders();

            // Assert
            Assert.AreEqual(false, warehouse.IsLorryRefrigerated(dispatchRequests[0].LorryType));
        }
コード例 #11
0
        public void When_some_stock_is_refrigerated_and_some_is_not_for_small_order_Then_refrigerated_lorry_is_used(string stockCode)
        {
            // Arrange
            var warehouse = new Warehouse();

            // Act
            warehouse.OrderStock("C", 6);
            warehouse.OrderStock(stockCode, 6);
            List<DispatchRequest> dispatchRequests = warehouse.ReconcileOrders();

            // Assert
            Assert.AreEqual(true, warehouse.IsLorryRefrigerated(dispatchRequests[0].LorryType));
        }