You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1008 B
30 lines
1008 B
2 years ago
|
using System.IO.Abstractions;
|
||
9 months ago
|
using System.Text.Json;
|
||
9 months ago
|
using Recyclarr.Tests.TestLibrary;
|
||
9 months ago
|
using Recyclarr.TrashGuide.CustomFormat;
|
||
2 years ago
|
|
||
9 months ago
|
namespace Recyclarr.IntegrationTests;
|
||
2 years ago
|
|
||
|
[TestFixture]
|
||
|
[Parallelizable(ParallelScope.All)]
|
||
9 months ago
|
public class CustomFormatLoaderIntegrationTest : IntegrationTestFixture
|
||
2 years ago
|
{
|
||
|
[Test]
|
||
|
public void Get_custom_format_json_works()
|
||
|
{
|
||
9 months ago
|
var sut = Resolve<CustomFormatLoader>();
|
||
9 months ago
|
Fs.AddFile("first.json", new MockFileData("""{"name":"first","trash_id":"1"}"""));
|
||
|
Fs.AddFile("second.json", new MockFileData("""{"name":"second","trash_id":"2"}"""));
|
||
2 years ago
|
Fs.AddFile("collection_of_cfs.md", new MockFileData(""));
|
||
2 years ago
|
|
||
2 years ago
|
var dir = Fs.CurrentDirectory();
|
||
|
var results = sut.LoadAllCustomFormatsAtPaths(new[] {dir}, dir.File("collection_of_cfs.md"));
|
||
2 years ago
|
|
||
|
results.Should().BeEquivalentTo(new[]
|
||
|
{
|
||
9 months ago
|
NewCf.Data("first", "1"),
|
||
|
NewCf.Data("second", "2")
|
||
9 months ago
|
}, o => o.Excluding(x => x.Type == typeof(JsonElement)));
|
||
2 years ago
|
}
|
||
|
}
|