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:
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user