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.
38 lines
1.1 KiB
38 lines
1.1 KiB
using FluentAssertions;
|
|
using NSubstitute;
|
|
using NUnit.Framework;
|
|
using Recyclarr.Cli.Console.Helpers;
|
|
using Recyclarr.TestLibrary.AutoFixture;
|
|
using Recyclarr.TrashLib.Config.Services;
|
|
|
|
namespace Recyclarr.Cli.Tests.Console.Helpers;
|
|
|
|
[TestFixture]
|
|
[Parallelizable(ParallelScope.All)]
|
|
public class CacheStoragePathTest
|
|
{
|
|
[Test, AutoMockData]
|
|
public void Use_guid_when_no_name(CacheStoragePath sut)
|
|
{
|
|
var config = Substitute.ForPartsOf<ServiceConfiguration>();
|
|
config.BaseUrl = new Uri("http://something");
|
|
config.InstanceName = null;
|
|
|
|
var result = sut.CalculatePath(config, "obj");
|
|
|
|
result.FullName.Should().MatchRegex(@".*[/\\][a-f0-9]+[/\\]obj\.json$");
|
|
}
|
|
|
|
[Test, AutoMockData]
|
|
public void Use_name_when_not_null(CacheStoragePath sut)
|
|
{
|
|
var config = Substitute.ForPartsOf<ServiceConfiguration>();
|
|
config.BaseUrl = new Uri("http://something");
|
|
config.InstanceName = "thename";
|
|
|
|
var result = sut.CalculatePath(config, "obj");
|
|
|
|
result.FullName.Should().MatchRegex(@".*[/\\]thename_[a-f0-9]+[/\\]obj\.json$");
|
|
}
|
|
}
|