b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using Theriapolis.Core;
|
|
using Theriapolis.Core.Persistence;
|
|
using Xunit;
|
|
|
|
namespace Theriapolis.Tests.Persistence;
|
|
|
|
/// <summary>
|
|
/// Phase 5 M2 refuses Phase-4 saves rather than auto-instantiating a default
|
|
/// Character. Verified via <see cref="SaveCodec.IsCompatible"/> +
|
|
/// <see cref="SaveCodec.IncompatibilityReason"/>.
|
|
/// </summary>
|
|
public sealed class V4ToV5MigrationTests
|
|
{
|
|
[Fact]
|
|
public void V4Header_IsRejectedAsIncompatible()
|
|
{
|
|
var header = new SaveHeader { Version = 4 };
|
|
Assert.False(SaveCodec.IsCompatible(header));
|
|
Assert.NotEmpty(SaveCodec.IncompatibilityReason(header));
|
|
}
|
|
|
|
[Fact]
|
|
public void V5Header_IsCompatible()
|
|
{
|
|
var header = new SaveHeader { Version = 5 };
|
|
Assert.True(SaveCodec.IsCompatible(header));
|
|
Assert.Empty(SaveCodec.IncompatibilityReason(header));
|
|
}
|
|
|
|
[Fact]
|
|
public void NewSaveHeader_AutoSetsCurrentSchemaVersion()
|
|
{
|
|
var header = new SaveHeader();
|
|
Assert.Equal(C.SAVE_SCHEMA_VERSION, header.Version);
|
|
Assert.True(header.Version >= C.SAVE_SCHEMA_MIN_VERSION);
|
|
}
|
|
|
|
[Fact]
|
|
public void IncompatibilityReason_MentionsVersionInformation()
|
|
{
|
|
var header = new SaveHeader { Version = 3 };
|
|
var reason = SaveCodec.IncompatibilityReason(header);
|
|
Assert.Contains("v3", reason);
|
|
Assert.Contains("v" + C.SAVE_SCHEMA_MIN_VERSION, reason);
|
|
}
|
|
}
|