- Shared SQLite plumbing: PRAGMAs (WAL/NORMAL/foreign_keys) and user_version migrations with typed SchemaVersionException - Workspace folder: .ykanban initialization, empty schema with DDL-level constraints, preset column seeding (ResX-driven), exclusive lock file with holder diagnostics - AppData folder: app.db workspace registry (injectable clock), app.json config store with kebab-case JSON names via explicit [JsonProperty]/[EnumMember], nested sections, corrupt-file backup - ResX infrastructure under Assets/Locales (en + zh-Hans) with MSBuild strongly-typed public Resources class - 54 unit tests: DDL constraints, migrations, PRAGMAs, lock exclusivity, config degradation, culture-aware presets
60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using System.Globalization;
|
|
using YKanBan.Storage.Workspace;
|
|
using YKanBan.Tests.TestUtilities;
|
|
|
|
namespace YKanBan.Tests.Storage.Workspace;
|
|
|
|
/// <summary>
|
|
/// Verifies that preset column titles follow the UI language active at
|
|
/// seeding time and then live as ordinary data. Mutates the global
|
|
/// Resources.Culture, therefore marked DoNotParallelize.
|
|
/// </summary>
|
|
[TestClass]
|
|
[DoNotParallelize]
|
|
public class PresetColumnCultureTests
|
|
{
|
|
[TestMethod]
|
|
public void PresetTitlesAreEnglishUnderEnglishCulture()
|
|
{
|
|
CultureInfo? original = Resources.Culture;
|
|
try
|
|
{
|
|
Resources.Culture = new CultureInfo("en");
|
|
using var directory = new TempDirectory();
|
|
WorkspaceInitializer.Initialize(directory.FullPath);
|
|
WorkspacePreset.SeedColumns(directory.FullPath);
|
|
|
|
using var connection = SqliteTestHelper.OpenWorkspace(directory.FullPath);
|
|
CollectionAssert.AreEqual(
|
|
new[] { "To Do", "In Progress", "Done" },
|
|
SqliteTestHelper.GetColumnTitles(connection));
|
|
}
|
|
finally
|
|
{
|
|
Resources.Culture = original;
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
public void PresetTitlesAreChineseUnderChineseCulture()
|
|
{
|
|
CultureInfo? original = Resources.Culture;
|
|
try
|
|
{
|
|
Resources.Culture = new CultureInfo("zh-Hans");
|
|
using var directory = new TempDirectory();
|
|
WorkspaceInitializer.Initialize(directory.FullPath);
|
|
WorkspacePreset.SeedColumns(directory.FullPath);
|
|
|
|
using var connection = SqliteTestHelper.OpenWorkspace(directory.FullPath);
|
|
CollectionAssert.AreEqual(
|
|
new[] { "待办", "进行中", "已完成" },
|
|
SqliteTestHelper.GetColumnTitles(connection));
|
|
}
|
|
finally
|
|
{
|
|
Resources.Culture = original;
|
|
}
|
|
}
|
|
}
|