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.
recyclarr/src/Recyclarr.Tests/Command/CreateConfigCommandTest.cs

34 lines
926 B

using System.IO.Abstractions.TestingHelpers;
using AutoFixture.NUnit3;
using CliFx.Infrastructure;
using FluentAssertions;
using NSubstitute;
using NUnit.Framework;
using Recyclarr.Command;
using TestLibrary.AutoFixture;
using TrashLib;
// ReSharper disable MethodHasAsyncOverload
namespace Recyclarr.Tests.Command;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class CreateConfigCommandTest
{
[Test, AutoMockData]
public async Task Config_file_created_when_using_default_path(
[Frozen] IAppPaths paths,
[Frozen(Matching.ImplementedInterfaces)] MockFileSystem fs,
CreateConfigCommand cmd)
{
const string ymlPath = "path/recyclarr.yml";
paths.ConfigPath.Returns(ymlPath);
await cmd.ExecuteAsync(Substitute.For<IConsole>());
var file = fs.GetFile(ymlPath);
file.Should().NotBeNull();
file.Contents.Should().NotBeEmpty();
}
}