Exemple #1
0
        public string convertTime(string aTime)
        {
            //try parsing input time
            Time time;

            if (!Time.TryParse(aTime, out time))
            {
                return("Unknown time format");
            }
            return(GetLine1(time) + GetLine2(time) + GetLine3(time) + GetLine4(time) +
                   GetLine5(time));
        }
        public string ConvertTimeRepresentation(string iso8601Time)
        {
            string result;

            if (Time.TryParse(iso8601Time, out Time time))
            {
                IClock clock = new Models.BerlinClock(time);
                result = clock.GetTimeString();
            }
            else
            {
                throw new ApplicationException(ErrorMessages.IncorrectTimeFormat);
            }

            return(result);
        }
Exemple #3
0
 public void TryParse_Must_Return_False_And_Output_Default_Value(string time)
 {
     Assert.IsFalse(Time.TryParse(time, out Time result));
     Assert.AreEqual(default(Time), result);
 }
Exemple #4
0
 public void TryParse_Must_Return_True_And_Output_Expected(string time, Time expected)
 {
     Assert.IsTrue(Time.TryParse(time, out Time result));
     Assert.AreEqual(expected, result);
 }