Files
Nonemm/tests/Nonemm.App.Tests/UserPathsTests.cs
ericek111 d5b5233ab8 Drop the migration from the older folder
Nothing has shipped, so there is nothing to migrate: the program makes
Documents/N1MM Logger+ and starts there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
2026-08-31 23:09:01 +00:00

66 lines
1.9 KiB
C#

using Nonemm.App.Configuration;
namespace Nonemm.App.Tests;
/// The folders under the user's own directory, which are N1MM's.
public class UserPathsTests : IDisposable
{
private readonly string root = Path.Combine(Path.GetTempPath(), $"nonemm-{Guid.NewGuid():N}");
public void Dispose()
{
if (Directory.Exists(root))
{
Directory.Delete(root, recursive: true);
}
}
[Fact]
public void TheFoldersAreN1mmsOwnNames()
{
UserPaths paths = new(root);
paths.CreateFolders();
string[] made = [.. Directory.GetDirectories(root).Select(Path.GetFileName).OfType<string>().Order()];
Assert.Equal(
[
"CallHistoryFiles", "Databases", "Diagnostics", "ExportFiles", "FunctionKeyMessages",
"GoalFiles", "LettersFiles", "Nonemm", "QsoRecording", "SkinsAndLayouts",
"SupportFiles", "SystemFiles", "TransactionLogFiles", "UserDefinedContests", "Wav",
],
made);
}
/// N1MM plays `Wav\<operator>\Cq.wav`, so that is where the recordings of
/// whoever is at the microphone are looked for here as well.
[Fact]
public void AnOperatorHasHisOwnFolderOfRecordings()
{
UserPaths paths = new(root);
Assert.Equal(Path.Combine(root, "Wav", "OM3KFF"), paths.WavFor("om3kff"));
Assert.Equal(Path.Combine(root, "Wav"), paths.WavFor(" "));
}
[Fact]
public void MakingTheFoldersTwiceIsNotAnError()
{
UserPaths paths = new(root);
paths.CreateFolders();
paths.CreateFolders();
Assert.True(Directory.Exists(paths.Wav));
}
/// What N1MM has no place for lives in a folder of this program's own.
[Fact]
public void TheSettingsFileIsInOurOwnFolder()
{
UserPaths paths = new(root);
Assert.Equal(Path.Combine(root, "Nonemm", "settings.json"), paths.SettingsFile);
}
}