public void stretchBy_factor_of_one_point_5() { sut.StretchBy(1.5); Assert.That(sut.Subtitles[0].Begin, Is.EqualTo(new TimeSpan(0, 0, 45))); Assert.That(sut.Subtitles[0].End, Is.EqualTo(new TimeSpan(0, 0, 48))); Assert.That(sut.Subtitles[0].Duration, Is.EqualTo(new TimeSpan(0, 0, 3))); // Assuming the middle part is right too... Assert.That(sut.Subtitles[5].Begin, Is.EqualTo(new TimeSpan(0, 0, 7, 34, 500))); Assert.That(sut.Subtitles[5].End, Is.EqualTo(new TimeSpan(0, 7, 51))); Assert.That(sut.Subtitles[5].Duration, Is.EqualTo(new TimeSpan(0, 0, 0, 16, 500))); }
static void Main(string[] args) { try { var options = new SubbedOptionParser(args); if (options.ActionVerb == Verbs.Help) { options.WriteHelp(); return; } var parserFactory = new SubtitleParserFactory(); ISubtitleParser reader = parserFactory.GetReaderFor(options.InputFile); IEnumerable <ISubtitle> subs = reader.Read(options.InputFile); var subManager = new SubtitleManager(subs); switch (options.ActionVerb) { case Verbs.Extrapolate: ISubtitle targetSub = subs.FirstOrDefault(options.SubtitleSelector); subManager.Extrapolate(targetSub, options.TimeDiff); break; case Verbs.StretchBy: subManager.StretchBy(options.Factor); break; case Verbs.TransposeBy: subManager.TransposeBy(options.TimeDiff); break; } subs = subManager.Subtitles; ISubtitleParser writer = parserFactory.GetWriterFor(options.OutputFile); writer.Write(subs, options.OutputFile); } catch (Exception ex) { Console.WriteLine(ex); } }