Files
Nonemm/tests/Nonemm.Spotting.Tests/SpotDescriptionTests.cs
T
erikbrockoandClaude Sonnet 5.5 b32c09aeef Add a 60 kHz bandmap zoom, a mode-wide zoom and denser scale ticks
The zoom list gains 60 kHz and a "mode" level that shows the CW, digital
or phone part of the band the receiver is in, before "band". For views
from 40 to 200 kHz wide, the scale picks the smallest round step that
keeps three lines of text between ticks. The font size buttons are
removed; Ctrl with the wheel or plus and minus still change the size.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 12:12:35 +00:00

77 lines
2.3 KiB
C#

using Nonemm.Core;
namespace Nonemm.Spotting.Tests;
public class SpotDescriptionTests
{
private static readonly DateTime At = new(2026, 5, 30, 12, 1, 0, DateTimeKind.Utc);
private static readonly DateTime Now = At.AddMinutes(41);
[Fact]
public void ASpotNamesTheSpotterTheTimeAndTheComment()
{
Spot spot = new(
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
"K1TTT", "CW 26 dB");
Assert.Equal("14025.0 by K1TTT, 41m ago\nCW 26 dB", SpotDescription.Of(spot, Now));
}
[Fact]
public void ASpotWithoutACommentOrSpotterHasOneLine()
{
Spot spot = new(
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Log);
Assert.Equal("14025.0, 41m ago", SpotDescription.Of(spot, Now));
}
[Theory]
[InlineData("USB")]
[InlineData("lsb")]
[InlineData("SSB\a\a")]
public void ASidebandAloneIsLeftOut(string comment)
{
Spot spot = new(
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
"K1TTT", comment);
Assert.Equal("14025.0 by K1TTT, 41m ago", SpotDescription.Of(spot, Now));
}
[Fact]
public void ControlCharactersAreDroppedFromTheComment()
{
Spot spot = new(
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
"K1TTT", "CW 26 dB\r\a");
Assert.Equal("14025.0 by K1TTT, 41m ago\nCW 26 dB", SpotDescription.Of(spot, Now));
}
[Theory]
[InlineData(20, "14025.0, 0m ago")]
[InlineData(3600 + 300, "14025.0, 1h 5m ago")]
public void TheAgeIsInMinutesThenHours(int seconds, string expected)
{
Spot spot = new(
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Log);
Assert.Equal(expected, SpotDescription.Of(spot, At.AddSeconds(seconds)));
}
[Fact]
public void ALocalSpotNamesTheComputerInsteadOfTheSpotter()
{
Spot spot = new(
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Operator,
"OK1ABC")
{
Computer = "SHACK-2",
};
Assert.Equal("14025.0 by SHACK-2, 41m ago", SpotDescription.Of(spot, Now));
}
}