mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-01 12:11:13 +00:00
31 lines
938 B
C#
31 lines
938 B
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Shouldly;
|
|
using Xunit;
|
|
using ZonyLrcTools.Cli.Infrastructure.IO;
|
|
|
|
namespace ZonyLrcTools.Tests
|
|
{
|
|
public class FileScannerTests : TestBase
|
|
{
|
|
[Fact]
|
|
public async Task ScanAsync_Test()
|
|
{
|
|
var tempMusicFilePath = Path.Combine(Directory.GetCurrentDirectory(), "Temp.mp3");
|
|
File.Create(tempMusicFilePath);
|
|
|
|
var fileScanner = ServiceProvider.GetRequiredService<IFileScanner>();
|
|
var result = await fileScanner.ScanAsync(
|
|
Path.GetDirectoryName(tempMusicFilePath),
|
|
new[] {"*.mp3", "*.flac"});
|
|
|
|
result.Count.ShouldBe(2);
|
|
result.First(e => e.ExtensionName == ".mp3").FilePaths.Count.ShouldNotBe(0);
|
|
|
|
File.Delete(tempMusicFilePath);
|
|
}
|
|
}
|
|
} |