Keep N1MM's message columns when the contest definition is saved again

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 03:50:24 +00:00
co-authored by Claude Sonnet 5.5
parent 393b73f87a
commit b8007355e4
2 changed files with 48 additions and 1 deletions
@@ -195,4 +195,40 @@ public class SqliteLogStoreTests : IDisposable
command.CommandText = sql;
command.ExecuteNonQuery();
}
[Fact]
public void SavingADefinitionAgainKeepsTheMessagesN1mmStored()
{
ContestDefinition definition = new()
{
Name = "CQWWCW",
DisplayName = "CQ WorldWide CW",
CabrilloName = "CQ-WW-CW",
Mode = "CW",
};
using (SqliteLogStore store = SqliteLogStore.Open(path))
{
store.SaveContestDefinition(definition);
}
using (SqliteConnection connection = new($"Data Source={path}"))
{
connection.Open();
using SqliteCommand set = connection.CreateCommand();
set.CommandText = "UPDATE Contest SET CWMessages = 'F1;CQ' WHERE Name = 'CQWWCW'";
set.ExecuteNonQuery();
}
using (SqliteLogStore store = SqliteLogStore.Open(path))
{
store.SaveContestDefinition(definition with { DisplayName = "Renamed" });
}
using SqliteConnection check = new($"Data Source={path}");
check.Open();
using SqliteCommand read = check.CreateCommand();
read.CommandText = "SELECT DisplayName, CWMessages FROM Contest WHERE Name = 'CQWWCW'";
using SqliteDataReader row = read.ExecuteReader();
Assert.True(row.Read());
Assert.Equal(("Renamed", "F1;CQ"), (row.GetString(0), row.GetString(1)));
}
}