acdream/tests/AcDream.App.Tests/Combat/CombatFeedbackSlotTests.cs

59 lines
1.5 KiB
C#

using System.Numerics;
using AcDream.App.Combat;
using AcDream.Core.Combat;
using AcDream.UI.Abstractions.Panels.Debug;
namespace AcDream.App.Tests.Combat;
public sealed class CombatFeedbackSlotTests
{
[Fact]
public void ExpectedOwnerUnbindCannotClearReplacement()
{
var slot = new CombatFeedbackSlot();
using DebugVM first = CreateViewModel();
using DebugVM second = CreateViewModel();
slot.Bind(first);
slot.Unbind(second);
slot.Show("first");
Assert.Single(first.RecentToasts);
Assert.Empty(second.RecentToasts);
slot.Unbind(first);
slot.Bind(second);
slot.Show("second");
Assert.Single(second.RecentToasts);
}
private static DebugVM CreateViewModel() => new(
static () => Vector3.Zero,
static () => 0,
static () => 0,
static () => false,
static () => false,
static () => false,
static () => 0,
static () => 0,
static () => 0,
static () => 0,
static () => 0,
static () => 0,
static () => float.PositiveInfinity,
static () => "-",
static () => false,
static () => false,
static () => 0,
static () => 1,
static () => 0,
static () => false,
static () => "0",
static () => 0,
static () => "Clear",
static () => 0,
static () => 0,
static () => 0,
static () => 60,
static () => 16.7f,
new CombatState());
}