예제 #1
0
        public void MusicDuration()
        {
            var songPlayer = new SongPlayer(MP3MattRedman, GtTimeSignature.Time4x4);

            try
            {
                songPlayer.LoadStream();
                var duration = songPlayer.DurationAsSeconds;

                //Test the song duration with 1 second of tolerance (duration is not integer)
                Assert.LessOrEqual(0, Math.Abs(duration - 309)); //309 seg = 5min 9seg (this song according MediaPlayer)
                Assert.Greater(1, Math.Abs(duration - 309));
            }
            finally
            {
                songPlayer.Dispose();
            }
        }