forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WmaImporterTests.cs
45 lines (39 loc) · 2.02 KB
/
WmaImporterTests.cs
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
// MonoGame - Copyright (C) MonoGame Foundation, Inc
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using System.IO;
using Microsoft.Xna.Framework.Content.Pipeline;
using NUnit.Framework;
namespace MonoGame.Tests.ContentPipeline
{
class WmaImporterTests
{
[Test]
public void Arguments()
{
var context = new TestImporterContext("TestObj", "TestBin");
Assert.Throws<ArgumentNullException>(() => new WmaImporter().Import(null, context));
Assert.Throws<ArgumentNullException>(() => new WmaImporter().Import("", context));
Assert.Throws<ArgumentNullException>(() => new WmaImporter().Import(@"Assets/Audio/rock_loop_stereo.wma", null));
Assert.Throws<FileNotFoundException>(() => new WmaImporter().Import(@"this\does\not\exist.wma", context));
}
public void InvalidFormat()
{
Assert.Throws<InvalidContentException>(() => new WmaImporter().Import(@"Assets/Audio/rock_loop_stereo.wav", new TestImporterContext("TestObj", "TestBin")));
}
[TestCase(@"Assets/Audio/rock_loop_stereo.wma", 2, 176400, 44100, 16, 4)]
[TestCase(@"Assets/Audio/rock_loop_stereo.mp3", 2, 176400, 44100, 16, 4)]
public void Import(string sourceFile, int channels, int averageBytesPerSecond, int sampleRate, int bitsPerSample, int blockAlign)
{
var content = new WmaImporter().Import(sourceFile, new TestImporterContext("TestObj", "TestBin"));
Assert.AreEqual(1, content.Format.Format);
Assert.AreEqual(channels, content.Format.ChannelCount);
Assert.AreEqual(averageBytesPerSecond, content.Format.AverageBytesPerSecond);
Assert.AreEqual(sampleRate, content.Format.SampleRate);
Assert.AreEqual(bitsPerSample, content.Format.BitsPerSample);
Assert.AreEqual(blockAlign, content.Format.BlockAlign);
content.Dispose();
}
}
}