From 6121e171760233b83cf05e66d3c817a9c96d66f9 Mon Sep 17 00:00:00 2001 From: Martin Finkel Date: Wed, 5 Jun 2024 11:40:15 +0200 Subject: [PATCH] add meta extra test --- src/LibVLCSharp.Tests/EventManagerTests.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/LibVLCSharp.Tests/EventManagerTests.cs b/src/LibVLCSharp.Tests/EventManagerTests.cs index 459ac133..1691dd5f 100644 --- a/src/LibVLCSharp.Tests/EventManagerTests.cs +++ b/src/LibVLCSharp.Tests/EventManagerTests.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using System.Threading.Tasks; using LibVLCSharp; using NUnit.Framework; @@ -11,7 +12,7 @@ public class EventManagerTests : BaseSetup { [Test] [Ignore("event does not fire in unit test")] - public async Task MetaChangedEventSubscribe() + public void MetaChangedEventSubscribe() { var media = new Media(Path.GetTempFileName()); var eventHandlerCalled = false; @@ -42,5 +43,24 @@ public async void DurationChanged() Assert.True(called); Assert.NotZero(duration); } + + [Test] + public void MetaExtraTest() + { + var key = "key"; + var value = "value"; + + var media = new Media(LocalAudioFile); + + media.SetMetaExtra(key, value); + + Assert.AreEqual(value, media.MetaExtra(key)); + Assert.AreEqual(key, media.MetaExtraNames.Single()); + + media.SetMetaExtra(key, null); + + Assert.AreEqual(null, media.MetaExtra(key)); + Assert.IsEmpty(media.MetaExtraNames); + } } }