public void ParseDurationWithNullStringTest() { //Arrange var parser = new VideoFfmpegParser(); //Act var result = parser.ParseDuration(null); //Assert Assert.AreEqual(0, result); }
public void ParseDurationWithIncorrectStringTest() { //Arrange const string str = "incorrect string"; var parser = new VideoFfmpegParser(); //Act var result = parser.ParseDuration(str); //Assert Assert.AreEqual(0, result); }
public void ParseDurationTest() { //Arrange const int hour = 3; const int min = 54; const double sec = 23; const string ffmpegDurationTime = " Duration: {0}:{1}:{2}, start: 0.000000, bitrate: 891 kb/s"; var str = String.Format(ffmpegDurationTime, hour.ToString("d2"), min.ToString("d2"), sec.ToString("f2")); var parser = new VideoFfmpegParser(); //Act var result = parser.ParseDuration(str); //Assert Assert.AreEqual(hour * 3600 + min * 60 + sec, result); }