Files
Nonemm/tests/Nonemm.Contests.Tests/TestLog.cs
Erik 0f84bc8972 Add the core, contest, storage and format layers
Frequencies, bands, modes, callsigns, grid squares and the country file live in
Nonemm.Core. Nonemm.Contests holds the scoring engine and CQ WW and CQ WPX.
Nonemm.Storage writes N1MM's DXLOG schema, and Nonemm.Formats writes Cabrillo
3.0 and reads and writes ADIF.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 10:27:51 +00:00

70 lines
2.1 KiB
C#

using Nonemm.Core;
using Nonemm.Core.Country;
namespace Nonemm.Contests.Tests;
/// A country file and QSO builder small enough to read, so a scoring test says
/// what it is testing rather than how to build a contact.
public static class TestLog
{
public const string Countries = """
Germany: 14: 28: EU: 51.00: -10.00: -1.0: DL:
DA,DB,DC,DD,DE,DF,DG,DH,DJ,DK,DL,DM,DO,DP,DQ,DR;
Italy: 15: 28: EU: 42.83: -12.83: -1.0: I:
I,IK,IZ;
United States: 05: 08: NA: 37.60: 91.87: 5.0: K:
K,W,N,AA,K6(3)[6];
Canada: 05: 09: NA: 44.35: 78.75: 5.0: VE:
VE,VA;
Japan: 25: 45: AS: 36.40: -138.38: -9.0: JA:
JA,JH,JR,7K;
Brazil: 11: 15: SA: -10.00: 55.00: 3.0: PY:
PY,PP;
""";
public static readonly CountryFile CountryFile = CountryFile.Parse(Countries);
public static readonly StationInfo Germany = new()
{
Callsign = "DL1ABC",
CqZone = 14,
ItuZone = 28,
Continent = "EU",
CountryPrefix = "DL",
};
public static readonly StationInfo UnitedStates = new()
{
Callsign = "K1ABC",
CqZone = 5,
ItuZone = 8,
Continent = "NA",
CountryPrefix = "K",
State = "CT",
ArrlSection = "CT",
};
public static Qso Contact(
string call,
double kilohertz = 14_025,
Mode? mode = null,
int zone = 0,
int number = 0,
string exchange = "",
string section = "",
DateTime? at = null) =>
new()
{
Id = Qso.NewId(),
TimestampUtc = at ?? new DateTime(2026, 5, 30, 12, 0, 0, DateTimeKind.Utc),
Call = Callsign.Parse(call),
Frequency = Frequency.FromKilohertz(kilohertz),
Mode = mode ?? Modes.Cw,
ContestName = "TEST",
Zone = zone,
ReceivedNumber = number,
Exchange1 = exchange,
Section = section,
};
}