コード例 #1
0
        public string ConvertTime(string aTime)
        {
            if (!ExtendedTimeParser.TryParse(aTime, out TimeSpan dayTime))
            {
                throw new ArgumentException($"Failed to parse {aTime} as a time string.", nameof(aTime));
            }

            _clock.UpdateTime(dayTime);

            var berlinTime = new StringBuilder();

            PrintBulb(berlinTime, _clock.SecondsBulb);
            berlinTime.AppendLine();
            PrintBulbs(berlinTime, _clock.BigHoursBulbs);
            berlinTime.AppendLine();
            PrintBulbs(berlinTime, _clock.HoursBulbs);
            berlinTime.AppendLine();
            PrintBulbs(berlinTime, _clock.BigMinutesBulbs);
            berlinTime.AppendLine();
            PrintBulbs(berlinTime, _clock.MinutesBulbs);

            return(berlinTime.ToString());
        }
コード例 #2
0
 public void Should_SuccessfullyParse(string input, bool expectedValue)
 {
     Assert.AreEqual(expectedValue, ExtendedTimeParser.TryParse(input, out TimeSpan _));
 }