Esempio n. 1
0
        public IEnumerable <TObject> CreateCollection(TempoMap tempoMap, params string[] timeAndLengthStrings)
        {
            var result = new List <TObject>();

            foreach (var timeAndLengthString in timeAndLengthStrings)
            {
                var parts  = timeAndLengthString.Split(';');
                var time   = TimeSpanUtilities.Parse(parts[0]);
                var length = TimeSpanUtilities.Parse(parts[1]);

                result.Add(Create(time, length, tempoMap));
            }

            return(result);
        }
Esempio n. 2
0
        public static void Parse(string input, ITimeSpan expectedTimeSpan)
        {
            TimeSpanUtilities.TryParse(input, out var actualTimeSpan);
            Assert.AreEqual(expectedTimeSpan,
                            actualTimeSpan,
                            "TryParse: incorrect result.");

            actualTimeSpan = TimeSpanUtilities.Parse(input);
            Assert.AreEqual(expectedTimeSpan,
                            actualTimeSpan,
                            "Parse: incorrect result.");

            Assert.AreEqual(expectedTimeSpan,
                            TimeSpanUtilities.Parse(expectedTimeSpan.ToString()),
                            "Parse: string representation was not parsed to the original time span.");
        }
Esempio n. 3
0
 public static void ParseInvalidInput(string input)
 {
     Assert.Throws <FormatException>(() => TimeSpanUtilities.Parse(input));
 }