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/TrashLib.Tests/Config/Settings/SettingsPersisterTest.cs

40 lines
1.1 KiB

using System.IO.Abstractions.TestingHelpers;
using AutoFixture.NUnit3;
using FluentAssertions;
using NUnit.Framework;
using TestLibrary.AutoFixture;
using TrashLib.Config;
using TrashLib.Config.Settings;
using TrashLib.Startup;
namespace TrashLib.Tests.Config.Settings;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class SettingsPersisterTest
{
[Test, AutoMockData]
public void Load_should_create_settings_file_if_not_exists(
[Frozen] MockFileSystem fileSystem,
[Frozen] IAppPaths paths,
SettingsProvider sut)
{
var settings = sut.Settings;
fileSystem.AllFiles.Should().ContainSingle(paths.SettingsPath.FullName);
}
[Test, AutoMockData]
public void Load_defaults_when_file_does_not_exist(
[Frozen(Matching.ImplementedInterfaces)] YamlSerializerFactory serializerFactory,
[Frozen] IAppPaths paths,
SettingsProvider sut)
{
var expectedSettings = new SettingsValues();
var settings = sut.Settings;
settings.Should().BeEquivalentTo(expectedSettings);
}
}