public void RemoveAt_OutOfRange() { var queue = new MediaQueue(); var tracks = new[] { new MediaFile(), new MediaFile(), new MediaFile(), }; queue.AddRange(tracks); queue.SetIndexAsCurrent(1); IList <NotifyCollectionChangedEventArgs> collectionChangedEvents = new List <NotifyCollectionChangedEventArgs>(); IList <PropertyChangedEventArgs> propertyChangedEvents = new List <PropertyChangedEventArgs>(); queue.CollectionChanged += (sender, e) => collectionChangedEvents.Add(e); queue.PropertyChanged += (sender, e) => propertyChangedEvents.Add(e); Assert.Throws <ArgumentOutOfRangeException>(() => { queue.RemoveAt(4); }); Assert.AreEqual(3, queue.Count); Assert.AreEqual(tracks[1], queue.Current); Assert.AreEqual(1, queue.Index); Assert.AreEqual(RepeatType.None, queue.Repeat); Assert.AreEqual(RepeatType.None, queue.Shuffle); Assert.AreEqual(0, propertyChangedEvents.Count); Assert.AreEqual(0, collectionChangedEvents.Count); }
public void RemoveAt_OutOfRange_Empty() { var queue = new MediaQueue(); IList <NotifyCollectionChangedEventArgs> collectionChangedEvents = new List <NotifyCollectionChangedEventArgs>(); IList <PropertyChangedEventArgs> propertyChangedEvents = new List <PropertyChangedEventArgs>(); queue.CollectionChanged += (sender, e) => collectionChangedEvents.Add(e); queue.PropertyChanged += (sender, e) => propertyChangedEvents.Add(e); Assert.Throws <ArgumentOutOfRangeException>(() => { queue.RemoveAt(-1); }); Assert.AreEqual(0, queue.Count); Assert.AreEqual(null, queue.Current); Assert.AreEqual(-1, queue.Index); Assert.AreEqual(RepeatType.None, queue.Repeat); Assert.AreEqual(RepeatType.None, queue.Shuffle); Assert.AreEqual(0, propertyChangedEvents.Count); Assert.AreEqual(0, collectionChangedEvents.Count); }