-
-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathEventManagerTests.cs
More file actions
66 lines (55 loc) · 1.77 KB
/
EventManagerTests.cs
File metadata and controls
66 lines (55 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using LibVLCSharp;
using NUnit.Framework;
namespace LibVLCSharp.Tests
{
[TestFixture]
public class EventManagerTests : BaseSetup
{
[Test]
[Ignore("event does not fire in unit test")]
public void MetaChangedEventSubscribe()
{
var media = new Media(Path.GetTempFileName());
var eventHandlerCalled = false;
const MetadataType description = MetadataType.Description;
media.MetaChanged += (sender, args) =>
{
Assert.AreEqual(description, args.MetadataType);
eventHandlerCalled = true;
};
media.SetMeta(MetadataType.Description, "test");
Assert.True(eventHandlerCalled);
}
public async void DurationChanged()
{
var media = new Media(LocalAudioFile);
var called = false;
long duration = 0;
media.DurationChanged += (sender, args) =>
{
called = true;
duration = args.Duration;
};
await media.ParseAsync(_libVLC);
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);
}
}
}