Split match/rejected tests, add wider sampling of extensions

pull/7349/head
Joe Rogers 3 years ago
parent cf033b25f8
commit a9a3f6bf02
No known key found for this signature in database
GPG Key ID: 0074AD57B8FDBBB4

@ -29,41 +29,54 @@ public class ExternalPathParserTests
} }
[Theory] [Theory]
[InlineData("", false)] [InlineData("")]
[InlineData("MyVideo.srt", false)] [InlineData("MyVideo.ass")]
[InlineData("MyVideo.mka", true)] [InlineData("MyVideo.mks")]
public void ParseFile_AudioFile_ReturnsPathWhenAudio(string path, bool valid) [InlineData("MyVideo.sami")]
[InlineData("MyVideo.srt")]
[InlineData("MyVideo.m4v")]
public void ParseFile_AudioExtensionsNotMatched_ReturnsNull(string path)
{
Assert.Null(_audioPathParser.ParseFile(path, string.Empty));
}
[Theory]
[InlineData("MyVideo.aa")]
[InlineData("MyVideo.aac")]
[InlineData("MyVideo.flac")]
[InlineData("MyVideo.m4a")]
[InlineData("MyVideo.mka")]
[InlineData("MyVideo.mp3")]
public void ParseFile_AudioExtensionsMatched_ReturnsPath(string path)
{ {
var actual = _audioPathParser.ParseFile(path, string.Empty); var actual = _audioPathParser.ParseFile(path, string.Empty);
Assert.NotNull(actual);
Assert.Equal(path, actual!.Path);
}
if (valid) [Theory]
{ [InlineData("")]
Assert.NotNull(actual); [InlineData("MyVideo.aa")]
Assert.Equal(path, actual!.Path); [InlineData("MyVideo.aac")]
} [InlineData("MyVideo.flac")]
else [InlineData("MyVideo.mka")]
{ [InlineData("MyVideo.m4v")]
Assert.Null(actual); public void ParseFile_SubtitleExtensionsNotMatched_ReturnsNull(string path)
} {
Assert.Null(_subtitlePathParser.ParseFile(path, string.Empty));
} }
[Theory] [Theory]
[InlineData("", false)] [InlineData("MyVideo.ass")]
[InlineData("MyVideo.srt", true)] [InlineData("MyVideo.mks")]
[InlineData("MyVideo.mka", false)] [InlineData("MyVideo.sami")]
public void ParseFile_SubtitleFile_ReturnsPathWhenSubtitle(string path, bool valid) [InlineData("MyVideo.srt")]
[InlineData("MyVideo.vtt")]
public void ParseFile_SubtitleExtensionsMatched_ReturnsPath(string path)
{ {
var actual = _subtitlePathParser.ParseFile(path, string.Empty); var actual = _subtitlePathParser.ParseFile(path, string.Empty);
Assert.NotNull(actual);
if (valid) Assert.Equal(path, actual!.Path);
{
Assert.NotNull(actual);
Assert.Equal(path, actual!.Path);
}
else
{
Assert.Null(actual);
}
} }
[Theory] [Theory]

Loading…
Cancel
Save