Пример #1
0
        public void AcquireLockTwiceThrows()
        {
            var mediaList = new MediaList(new LibVLC());

            mediaList.Lock();
            Assert.Throws <InvalidOperationException>(() => mediaList.Lock(), "already locked");
        }
Пример #2
0
        public void ReleaseLockTwiceThrows()
        {
            var mediaList = new MediaList(new LibVLC());

            mediaList.Lock();
            mediaList.Unlock();
            Assert.Throws <InvalidOperationException>(() => mediaList.Unlock(), "not locked");
        }
Пример #3
0
        public void AddAndRemoveMediaFromMediaList()
        {
            var mediaList   = new MediaList(_libVLC);
            var media       = new Media(_libVLC, Path.GetTempFileName());
            var itemAdded   = false;
            var itemDeleted = false;

            mediaList.ItemAdded   += (sender, args) => itemAdded = true;
            mediaList.ItemDeleted += (sender, args) => itemDeleted = true;
            mediaList.Lock();
            mediaList.AddMedia(media);
            Assert.AreEqual(media, mediaList[0]);
            Assert.AreEqual(1, mediaList.Count);
            Assert.True(itemAdded);
            Assert.Zero(mediaList.IndexOf(media));
            mediaList.RemoveIndex(0);
            Assert.Zero(mediaList.Count);
            Assert.True(itemDeleted);
            mediaList.Unlock();
        }