mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Implements tests for commit 45f9aa3bd5
This commit is contained in:
1 parent
d61a114d80
commit
aeefa9487e
44 files changed
+6929
-18
No files matched your search
+60
@@ -47,4 +47,64 @@ public class MusicMimeTypesTests
|
||||
// Assert
|
||||
Assert.Equal("application/octet-stream", result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("MP3", "audio/mpeg")] // mp3 container
|
||||
[InlineData("FLAC", "audio/flac")] // flac container
|
||||
[InlineData("MP4", "audio/mp4")] // mp4 container
|
||||
[InlineData("M4A", "audio/mp4")] // m4a container
|
||||
[InlineData("AAC", "audio/aac")] // aac container
|
||||
[InlineData("OGG", "audio/ogg")] // ogg container
|
||||
[InlineData("OPUS", "audio/ogg")] // opus container
|
||||
[InlineData("WAV", "audio/wav")] // wav container
|
||||
public void GetContainerMimeType_WhenContainerIsMapped_ShouldReturnMappedMimeType(string container, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
string result = MusicMimeTypes.GetContainerMimeType(container);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedMimeType, result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("mp3", "audio/mpeg")] // lowercase mp3 container
|
||||
[InlineData("Flac", "audio/flac")] // mixed case flac container
|
||||
[InlineData("mP4", "audio/mp4")] // mixed case mp4 container
|
||||
[InlineData("opus", "audio/ogg")] // lowercase opus container
|
||||
public void GetContainerMimeType_WhenContainerDiffersInCase_ShouldReturnMappedMimeType(string container, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
string result = MusicMimeTypes.GetContainerMimeType(container);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedMimeType, result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(" MP3 ", "audio/mpeg")] // leading and trailing whitespace around mp3
|
||||
[InlineData("\tOGG", "audio/ogg")] // leading tab around ogg
|
||||
[InlineData("WAV\n", "audio/wav")] // trailing newline around wav
|
||||
public void GetContainerMimeType_WhenContainerHasSurroundingWhitespace_ShouldReturnMappedMimeType(string container, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
string result = MusicMimeTypes.GetContainerMimeType(container);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedMimeType, result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)] // an absent container has no mime mapping
|
||||
[InlineData("")] // an empty container has no mime mapping
|
||||
[InlineData(" ")] // a whitespace only container has no mime mapping
|
||||
[InlineData("WMA")] // a known file format that is not a mapped delivery container
|
||||
[InlineData("not-a-container")] // an unknown container has no mime mapping
|
||||
public void GetContainerMimeType_WhenContainerIsUnknown_ShouldReturnOpaqueBinaryMimeType(string? container)
|
||||
{
|
||||
// Act
|
||||
string result = MusicMimeTypes.GetContainerMimeType(container);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("application/octet-stream", result);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user