Covers the pure-logic surface of commit 1:
VitalsVMTests
* HealthPercent reads from CombatState.GetHealthPercent
* safe-default 1.0 when GUID unknown / not yet set / never updated
* SetLocalPlayerGuid reroutes lookup to the new guid (no stale cache)
* StaminaPercent / ManaPercent are null for D.2a scope
* ctor throws ArgumentNullException on null CombatState
PanelContextTests
* record-struct fields round-trip
* value-based equality
NullCommandBusTests
* Publish accepts any record type without throwing
* Instance is a true singleton
csproj template mirrors AcDream.Core.Tests (xUnit 2.9.3, Test.Sdk 17.14.1,
runner 3.1.4, coverlet 6.0.4, implicit Using Xunit). References only
AcDream.UI.Abstractions — no runtime / GL dependency, tests run fast.
24 lines
766 B
C#
24 lines
766 B
C#
namespace AcDream.UI.Abstractions.Tests;
|
|
|
|
public sealed class PanelContextTests
|
|
{
|
|
[Fact]
|
|
public void Fields_RoundTripThroughConstructor()
|
|
{
|
|
var ctx = new PanelContext(DeltaSeconds: 0.016f, Commands: NullCommandBus.Instance);
|
|
|
|
Assert.Equal(0.016f, ctx.DeltaSeconds);
|
|
Assert.Same(NullCommandBus.Instance, ctx.Commands);
|
|
}
|
|
|
|
[Fact]
|
|
public void RecordEquality_ByValue()
|
|
{
|
|
var a = new PanelContext(1f / 60f, NullCommandBus.Instance);
|
|
var b = new PanelContext(1f / 60f, NullCommandBus.Instance);
|
|
|
|
// Record-struct equality is value-based on DeltaSeconds + reference-based
|
|
// on Commands (since ICommandBus is a reference type, same instance → equal).
|
|
Assert.Equal(a, b);
|
|
}
|
|
}
|