public void ConvertDurationTest()
        {
            toUserFriendly = new ToUserFriendly();
            var d1 = toUserFriendly.ConvertDuration("03d10:58:15");
            var d2 = toUserFriendly.ConvertDuration("10d00:00:00");

            Assert.AreEqual("3 d 10 h 58 min", d1);
            Assert.AreEqual("10 d", d2);
        }
Exemplo n.º 2
0
        private void ShowConnections()
        {
            ToUserFriendly toUserFriendly = new ToUserFriendly();

            if (connections.Count > 0)
            {
                // Darstellung für DataGridView
                var connectionList = from connection in connections
                                     select new
                {
                    Dauer        = toUserFriendly.ConvertDuration(connection.Duration),
                    Gleis        = connection.From.Platform,
                    Von          = connection.From.Station.Name,
                    Abfahrtszeit = Convert.ToDateTime(connection.From.Departure).ToString("hh:MM"),
                    Nach         = connection.To.Station.Name,
                    Ankunftszeit = Convert.ToDateTime(connection.To.Arrival).ToString("hh:MM")
                };
                datConnections.DataSource = connectionList.ToList();
                datConnections.Refresh();
                datConnections.Visible = true;

                this.Height = 450;
            }
            else
            {
                datConnections.Visible = false;
                this.Height            = 180;
                MessageBox.Show("Die Station ist ungültig.", "Ungültige Station", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }