Exemplo n.º 1
0
        public void Third_Pickup_Test_Case()
        {
            //Arrange
            var quantityToPick = 24;
            var expectedResult = new List <InventoryToPick>()
            {
                new InventoryToPick(2, 12),
                new InventoryToPick(5, 12),
            };

            _locations.Add(new Location {
                Id = 1, QuantityAvailable = 10
            });
            _locations.Add(new Location {
                Id = 2, QuantityAvailable = 12
            });
            _locations.Add(new Location {
                Id = 3, QuantityAvailable = 10
            });
            _locations.Add(new Location {
                Id = 4, QuantityAvailable = 10
            });
            _locations.Add(new Location {
                Id = 5, QuantityAvailable = 12
            });

            var pickingLocations = new GoFlow.InventoryPickingLocations.PickingLocations(_locations);

            //Act
            var picks = pickingLocations.Calculate(quantityToPick);

            //Assert
            Assert.NotNull(picks);
            Assert.IsTrue(new InventoryToPickComparer().Equals(expectedResult, picks));
        }
Exemplo n.º 2
0
        public static void PickupLocations()
        {
            var id             = 1;
            var addNewLocation = true;
            var locations      = new List <Location>();

            Console.WriteLine("Enter the quantity to pick: ");
            int.TryParse(Console.ReadLine(), out int quantityToPick);

            Console.WriteLine("Note: To stop inserting locations use: x ");

            while (addNewLocation)
            {
                var input = Console.ReadLine();
                int.TryParse(input, out int locationQuantity);
                Console.WriteLine("Enter the location quantity: ");
                locations.Add(new Location {
                    Id = id++, QuantityAvailable = locationQuantity
                });
                if (input.ToLower() == "x")
                {
                    break;
                }
            }

            PickingLocations pickingLocations = new PickingLocations(locations);
            var picks = pickingLocations.Calculate(quantityToPick);

            foreach (var pick in picks)
            {
                Console.WriteLine($"\nLocation id: {pick.LocationId} quantity: {pick.Quantity}");
            }
        }