Example #1
0
        public void TestSeekEndOutOfBounds()
        {
            string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string path    = Path.Combine(dirName, "bensound-scifi.mp3");
            Mpg123 mpg123  = new Mpg123();

            mpg123.Open(path);

            byte[] buffer = new byte[1000];
            uint   end    = 0;

            while (mpg123.Read(buffer, ref end) != Mpg123.Errors.OK)
            {
            }

            long  offsets = 0;
            long  step    = 0;
            ulong fill    = 0;

            mpg123.Index(ref offsets, ref step, ref fill);

            //i expect to get an exception because the seek will be set to (end + 1)
            Assert.That(() => mpg123.Seek(-1, SeekOrigin.Begin), Throws.TypeOf <Mpg123.ErrorException>());
        }