public void AcquireLockTwiceThrows() { var mediaList = new MediaList(new LibVLC()); mediaList.Lock(); Assert.Throws <InvalidOperationException>(() => mediaList.Lock(), "already locked"); }
public void ReleaseLockTwiceThrows() { var mediaList = new MediaList(new LibVLC()); mediaList.Lock(); mediaList.Unlock(); Assert.Throws <InvalidOperationException>(() => mediaList.Unlock(), "not locked"); }
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(); }