Exemplo n.º 1
0
        public static Delivery[] GetDeliveries(string postal, int count)
        {
            var unique = new Dictionary <string, Delivery>();

            while (count-- >= 0)
            {
                var package = PackageGenerator.CreateDelivery(postal);
                if (!unique.TryGetValue(package.Destination.ToString(), out var existing))
                {
                    existing = new Delivery();
                    unique.Add(package.Destination.ToString(), existing);
                }

                existing.Packages.TryAdd(package.Airbill, package);
            }

            return(unique.Values.ToArray());
        }
Exemplo n.º 2
0
        public static Pickup[] GetPickups(string postal, int count)
        {
            var unique = new Dictionary <string, Pickup>();

            while (count-- >= 0)
            {
                var package = PackageGenerator.CreatePickup(postal);
                if (!unique.TryGetValue(package.Origin.ToString(), out var existing))
                {
                    existing = new Pickup();
                    unique.Add(package.Origin.ToString(), existing);
                }

                existing.Packages.TryAdd(package.Airbill, package);
            }

            return(unique.Values.ToArray());
        }