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.
72 lines
3.0 KiB
C#
72 lines
3.0 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Design;
|
|
|
|
/// <summary>
|
|
/// The template alarm authoring surface exposes <c>TemplateAlarm.IsMesReportable</c>:
|
|
/// an "MES reportable" checkbox in the dialog body and an MES column on the
|
|
/// template's Alarms tab. <c>TemplateEdit</c> is a heavyweight page (~10 injected
|
|
/// services with their own graphs), so — like the rest of the TemplateEdit coverage
|
|
/// in this suite (see <c>TemplateNativeAlarmSourceEditorTests</c>) — these are
|
|
/// structural assertions over the component source that pin the wiring so it cannot
|
|
/// silently regress. The persistence behaviour itself is covered by the
|
|
/// TemplateService / ManagementActor alarm tests.
|
|
/// </summary>
|
|
public class TemplateAlarmDialogMesReportableTests
|
|
{
|
|
private static string DesignComponentsRoot
|
|
{
|
|
get
|
|
{
|
|
var dir = AppContext.BaseDirectory;
|
|
for (var i = 0; i < 6 && dir is not null; i++)
|
|
dir = Directory.GetParent(dir)?.FullName;
|
|
return Path.Combine(dir!, "src", "ZB.MOM.WW.ScadaBridge.CentralUI",
|
|
"Components", "Pages", "Design");
|
|
}
|
|
}
|
|
|
|
private static string AlarmDialogMarkup
|
|
=> File.ReadAllText(Path.Combine(DesignComponentsRoot, "TemplateAlarmDialog.razor"));
|
|
|
|
private static string TemplateEditMarkup
|
|
=> File.ReadAllText(Path.Combine(DesignComponentsRoot, "TemplateEdit.razor"));
|
|
|
|
/// <summary>Verifies that the alarm dialog has a MES-reportable checkbox.</summary>
|
|
[Fact]
|
|
public void AlarmDialog_HasMesReportableCheckbox()
|
|
{
|
|
var markup = AlarmDialogMarkup;
|
|
Assert.Contains("@bind=\"_isMesReportable\"", markup);
|
|
Assert.Contains("id=\"alarmMesReportable\"", markup);
|
|
Assert.Contains("MES reportable", markup);
|
|
}
|
|
|
|
/// <summary>Verifies that the alarm dialog threads the MES-reportable flag through its parameter and draft.</summary>
|
|
[Fact]
|
|
public void AlarmDialog_ThreadsMesReportableThroughParameterAndDraft()
|
|
{
|
|
var markup = AlarmDialogMarkup;
|
|
Assert.Contains("InitialIsMesReportable", markup);
|
|
Assert.Contains("_isMesReportable = InitialIsMesReportable", markup);
|
|
Assert.Contains("bool IsMesReportable", markup);
|
|
}
|
|
|
|
/// <summary>Verifies that the alarms tab has a MES column.</summary>
|
|
[Fact]
|
|
public void AlarmsTab_HasMesColumn()
|
|
{
|
|
var markup = TemplateEditMarkup;
|
|
Assert.Contains("<th>MES</th>", markup);
|
|
Assert.Contains("data-test=\"alarm-mes-badge\"", markup);
|
|
Assert.Contains("alarm.IsMesReportable", markup);
|
|
}
|
|
|
|
/// <summary>Verifies that the alarms tab passes the MES-reportable flag into and out of the dialog.</summary>
|
|
[Fact]
|
|
public void AlarmsTab_PassesMesReportableIntoAndOutOfTheDialog()
|
|
{
|
|
var markup = TemplateEditMarkup;
|
|
Assert.Contains("InitialIsMesReportable=\"initial.IsMesReportable\"", markup);
|
|
Assert.Contains("IsMesReportable = draft.IsMesReportable", markup);
|
|
}
|
|
}
|