forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OggImporterTests.cs
44 lines (38 loc) · 1.93 KB
/
OggImporterTests.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
// MonoGame - Copyright (C) The MonoGame Team
// 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 OggImporterTests
{
[Test]
public void Arguments()
{
var context = new TestImporterContext("TestObj", "TestBin");
Assert.Throws<ArgumentNullException>(() => new OggImporter().Import(null, context));
Assert.Throws<ArgumentNullException>(() => new OggImporter().Import("", context));
Assert.Throws<ArgumentNullException>(() => new OggImporter().Import(@"Assets/Audio/rock_loop_stereo.ogg", null));
Assert.Throws<FileNotFoundException>(() => new OggImporter().Import(@"this\does\not\exist.ogg", context));
}
public void InvalidFormat()
{
Assert.Throws<InvalidContentException>(() => new OggImporter().Import(@"Assets/Audio/rock_loop_stereo.wav", new TestImporterContext("TestObj", "TestBin")));
}
[TestCase(@"Assets/Audio/rock_loop_stereo.ogg", 2, 176400, 44100, 16, 4)]
public void Import(string sourceFile, int channels, int averageBytesPerSecond, int sampleRate, int bitsPerSample, int blockAlign)
{
var content = new OggImporter().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();
}
}
}