Esempio n. 1
0
        private void audio_X_AAC_MP4_Atom(string atom, string atomCaption = null)
        {
            if (null == atomCaption)
            {
                atomCaption = atom;
            }

            ArrayLogger log              = new ArrayLogger();
            string      resource         = "AAC/mp4.m4a";
            string      location         = TestUtils.GetResourceLocationRoot() + resource;
            string      testFileLocation = TestUtils.GetTempTestFile(resource);

            using (FileStream fs = new FileStream(testFileLocation, FileMode.Open, FileAccess.ReadWrite, FileShare.Read))
            {
                StreamUtils.FindSequence(fs, Utils.Latin1Encoding.GetBytes(atom));
                fs.Seek(-1, SeekOrigin.Current);
                fs.WriteByte(0);

                Track           theTrack = new Track(fs, ".mp4");
                IList <LogItem> logItems = log.GetAllItems(Log.LV_ERROR);
                Assert.AreEqual(1, logItems.Count);
                Assert.AreEqual(atomCaption + " atom could not be found; aborting read", logItems[0].Message);
            }

            // Get rid of the working copy
            File.Delete(testFileLocation);
        }
Esempio n. 2
0
        public void PL_TestCommon()
        {
            IPlaylistReader theReader = PlaylistReaders.PlaylistReaderFactory.GetInstance().GetPlaylistReader(TestUtils.GetResourceLocationRoot() + "_Playlists/playlist_simple.m3u");

            Assert.AreEqual(TestUtils.GetResourceLocationRoot() + "_Playlists/playlist_simple.m3u", theReader.Path);

            ArrayLogger log = new ArrayLogger();

            try
            {
                theReader = PlaylistReaders.PlaylistReaderFactory.GetInstance().GetPlaylistReader(TestUtils.GetResourceLocationRoot() + "_Playlists/efiufhziuefizeub.m3u");
                theReader.GetFiles();
                Assert.Fail();
            } catch {
                IList <LogItem> logItems = log.GetAllItems(Log.LV_ERROR);
                Assert.AreEqual(1, logItems.Count);
                Assert.IsTrue(logItems[0].Message.Contains("efiufhziuefizeub.m3u")); // Can't do much more than than because the exception message is localized
            }
        }