513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using Bunit;
|
||
using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared;
|
||
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Streaming;
|
||
using ZB.MOM.WW.ScadaBridge.Commons.Types.Alarms;
|
||
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
||
|
||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Components;
|
||
|
||
/// <summary>
|
||
/// Covers the <c>AlarmStateBadges</c> shared component lifted out of
|
||
/// <c>DebugView</c>. The badge cluster must render identically
|
||
/// wherever it is hosted, so these tests pin the rendered markup: state badge
|
||
/// class, kind label, native sub-state badges, severity, and HiLo level.
|
||
/// </summary>
|
||
public class AlarmStateBadgesTests : BunitContext
|
||
{
|
||
private static AlarmStateChanged ActiveNativeHighUnacked() => new(
|
||
InstanceUniqueName: "Tank01",
|
||
AlarmName: "Tank01.Level.HiHi",
|
||
State: AlarmState.Active,
|
||
Priority: 700,
|
||
Timestamp: DateTimeOffset.UtcNow)
|
||
{
|
||
Kind = AlarmKind.NativeOpcUa,
|
||
Level = AlarmLevel.High,
|
||
Condition = new AlarmConditionState(
|
||
Active: true,
|
||
Acknowledged: false,
|
||
Confirmed: null,
|
||
Shelve: AlarmShelveState.Unshelved,
|
||
Suppressed: false,
|
||
Severity: 700),
|
||
};
|
||
|
||
/// <summary>Verifies that the state, kind, sub-state, severity and level badges are rendered.</summary>
|
||
[Fact]
|
||
public void Renders_StateKindSubStateSeverityAndLevel_Badges()
|
||
{
|
||
var alarm = ActiveNativeHighUnacked();
|
||
|
||
var cut = Render<AlarmStateBadges>(p => p.Add(c => c.Alarm, alarm));
|
||
|
||
// State badge: Active condition tinted danger.
|
||
Assert.Contains("bg-danger", cut.Markup);
|
||
Assert.Contains("Active", cut.Markup);
|
||
|
||
// Kind badge label for a native OPC UA alarm.
|
||
Assert.Contains("OPC UA", cut.Markup);
|
||
|
||
// Native sub-state badge: active + unacknowledged.
|
||
Assert.Contains("Unacked", cut.Markup);
|
||
|
||
// Severity span on the unified 0–1000 scale.
|
||
Assert.Contains("sev 700", cut.Markup);
|
||
|
||
// HiLo level badge label.
|
||
Assert.Contains("Hi", cut.Markup);
|
||
}
|
||
}
|