Files
Nonemm/tests/Nonemm.App.Tests/UserPathsTests.cs
ericek111 2c51b5293a Keep the files in N1MM's folders
The folders under the user's own directory are N1MM's now, with N1MM's names,
read out of N1MMLibrary.dll: Databases, SupportFiles, UserDefinedContests,
FunctionKeyMessages, CallHistoryFiles, ExportFiles, GoalFiles, LettersFiles,
QsoRecording, SkinsAndLayouts, SystemFiles, TransactionLogFiles, Diagnostics
and Wav. A station that runs both programs keeps its files in one shape.

An operator's recordings go in Wav/<his callsign>, which is where N1MM plays
them from, and the folder is made when he takes the radio. Cabrillo and ADIF
start in ExportFiles, call history files in CallHistoryFiles, and the .mc
function key files in FunctionKeyMessages.

N1MM's three *DDL folders and its Piper folders are left out: they hold the
migrations for N1MM's own admin databases and the program it speaks with.

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

57 lines
1.6 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", "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));
}
}