mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Implements tests for commit eecf4315c6
This commit is contained in:
1 parent
8b8d077c6a
commit
ab2940d665
3 files changed
+28
-3
No files matched your search
+13
@@ -75,4 +75,17 @@ public class AudioFileFormatUtilitiesTests
|
||||
// Assert
|
||||
Assert.Equal(AudioFileFormat.MP3, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToAudioFileFormat_WhenFilePathContainsDirectoriesAndMixedCaseExtension_ShouldReturnMappedFormat()
|
||||
{
|
||||
// Arrange
|
||||
string filePath = "library/music/Queen/A Night at the Opera (1975).Remastered/01 - Bohemian Rhapsody.FLAC";
|
||||
|
||||
// Act
|
||||
AudioFileFormat result = filePath.ToAudioFileFormat();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(AudioFileFormat.FLAC, result);
|
||||
}
|
||||
}
|
||||
+10
@@ -22,4 +22,14 @@ public class AudioFileFormatTests
|
||||
// Assert
|
||||
Assert.Equal(values.Length, values.Distinct().Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void None_WhenCastingToInteger_ShouldBeZero()
|
||||
{
|
||||
// Act
|
||||
int value = (int)AudioFileFormat.None;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(0, value);
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -36,11 +36,13 @@ public class MusicMimeTypesTests
|
||||
Assert.Equal(expectedMimeType, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetMimeType_WhenFormatIsNone_ShouldReturnOpaqueBinaryMimeType()
|
||||
[Theory]
|
||||
[InlineData(AudioFileFormat.None)] // the none audio format has no mime mapping
|
||||
[InlineData((AudioFileFormat)999)] // an unknown audio format has no mime mapping
|
||||
public void GetMimeType_WhenFormatIsUnknown_ShouldReturnOpaqueBinaryMimeType(AudioFileFormat format)
|
||||
{
|
||||
// Act
|
||||
string result = MusicMimeTypes.GetMimeType(AudioFileFormat.None);
|
||||
string result = MusicMimeTypes.GetMimeType(format);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("application/octet-stream", result);
|
||||
|
||||
Reference in new issue
Block a user