Commit 071a58f1 authored by Martin Finkel's avatar Martin Finkel

Implement IEnumerable<Media> instead of just IEnumerable

parent c415470c
......@@ -92,10 +92,10 @@ namespace LibVLCSharp.Tests
}
[Test]
public void GetTracks()
public async Task GetTracks()
{
var media = new Media(_libVLC, RealMp3Path);
media.Parse();
await media.Parse();
Assert.AreEqual(media.Tracks.Single().Data.Audio.Channels, 2);
Assert.AreEqual(media.Tracks.Single().Data.Audio.Rate, 44100);
}
......@@ -108,7 +108,7 @@ namespace LibVLCSharp.Tests
{
Assert.False(media.IsParsed);
media.Parse();
await media.Parse();
await Task.Delay(5000);
Assert.True(media.IsParsed);
Assert.AreEqual(MediaParsedStatus.Done, media.ParsedStatus);
......
......@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
namespace LibVLCSharp.Shared
{
public class MediaList : Internal, IEnumerable
public class MediaList : Internal, IEnumerable<Media>
{
MediaListEventManager _eventManager;
readonly object _syncLock = new object();
......@@ -293,9 +293,9 @@ namespace LibVLCSharp.Shared
base.Dispose(disposing);
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IEnumerator<Media> GetEnumerator() => new MediaListEnumerator(this);
public MediaListEnumerator GetEnumerator() => new MediaListEnumerator(this);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public class MediaListEnumerator : IEnumerator<Media>
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment