MediaDiscovererTests.cs 1.13 KB
Newer Older
1 2
using System;
using System.Linq;
Martin Finkel's avatar
Martin Finkel committed
3
using LibVLCSharp.Shared;
Martin Finkel's avatar
Martin Finkel committed
4 5
using NUnit.Framework;

6
namespace LibVLCSharp.Tests
Martin Finkel's avatar
Martin Finkel committed
7 8
{
    [TestFixture]
9
    public class MediaDiscovererTests : BaseSetup
Martin Finkel's avatar
Martin Finkel committed
10 11 12 13
    {
        [Test]
        public void CreateStartAndStopDiscoverer()
        {
Martin Finkel's avatar
Martin Finkel committed
14 15 16
            var libVLC = new LibVLC();
            var mds = libVLC.MediaDiscoverers(MediaDiscoverer.Category.Lan);
            var md = new MediaDiscoverer(libVLC, mds.First().Name);
Martin Finkel's avatar
Martin Finkel committed
17 18 19 20 21
            Assert.True(md.Start());
            Assert.True(md.IsRunning);
            md.Stop();
            Assert.False(md.IsRunning);
        }
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

        [Test]
        public void DisposeMediaDiscoverer()
        {
            var libVLC = new LibVLC();
            var mds = libVLC.MediaDiscoverers(MediaDiscoverer.Category.Lan);
            var md = new MediaDiscoverer(libVLC, mds.First().Name);
            Assert.True(md.Start());
            Assert.True(md.IsRunning);
            Assert.NotNull(md.MediaList);
            md.Dispose();
            Assert.IsNull(md.MediaList);
            Assert.False(md.IsRunning);
            Assert.AreEqual(IntPtr.Zero, md.NativeReference);
        }
Martin Finkel's avatar
Martin Finkel committed
37 38
    }
}