public Route Copy(TimeSpan increment, string name = "")
        {
            Route copy = new Route();

            foreach (PropertyInfo property in typeof(Route).GetProperties())
            {
                if (property.PropertyType == typeof(List<Schedule>))
                {
                    var schedules = (List<Schedule>)property.GetValue(this);

                    if (schedules != null)
                    {
                        List<Schedule> newSchedules = new List<Schedule>();

                        foreach (Schedule s in schedules)
                        {
                            Schedule newSchedule = s.Copy();
                            newSchedule.Route = copy;
                            newSchedules.Add(newSchedule);
                        }

                        property.SetValue(copy, newSchedules);
                    }
                }
                else
                {
                    property.SetValue(copy, property.GetValue(this));
                }
            }

            if (copy.Schedules != null)
                copy.Schedules.ForEach(schedule => {
                    schedule.Time += increment;
                    schedule.Time = new TimeSpan(schedule.Time.Value.Hours, schedule.Time.Value.Minutes, 0);
                });

            if (name != "")
                copy.Name = name;
            else
                copy.UpdateName();

            return copy;
        }
        public void Update_Route_Name_For_Empty()
        {
            // Arange
            List<Schedule> schedules = new List<Schedule>();
            string oldName = "RouteName";

            Route route = new Route { Name = oldName, Schedules = schedules };

            // Act
            route.UpdateName();

            // Assert
            Assert.AreEqual(route.Name, "Empty");
        }
        public void Update_Route_Name()
        {
            // Arange
            List<Schedule> schedules = new List<Schedule>();
            int numberOfSchedules = 10;
            string oldName = "RouteName";

            for (int i = 0; i < numberOfSchedules; i++)
            {
                Pier pier = new Pier { Id = i, Name = "Pier " + i };
                schedules.Add(new Schedule { Time = new TimeSpan(i, 0, 0), Pier = pier });
            }

            Route route = new Route { Name = oldName, Schedules = schedules };

            // Act
            route.UpdateName();

            // Assert
            Assert.AreEqual(route.Name, "00:00 Pier 0 to Pier 9");
        }