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.
55 lines
2.5 KiB
C#
55 lines
2.5 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Deployment;
|
|
|
|
/// <summary>
|
|
/// Design 2026-08-20: the Connection Bindings panel must be driven by the flattened
|
|
/// configuration (every composed module member), not by the template's direct
|
|
/// attributes — 264 of Z28061's 280 bindings were invisible on QA. Structural pins
|
|
/// over the page source, matching the existing InstanceConfigure coverage style.
|
|
/// </summary>
|
|
public class InstanceConfigureBindingRowsTests
|
|
{
|
|
/// <summary>Reads the InstanceConfigure page markup from the source tree.</summary>
|
|
/// <returns>The full text of <c>InstanceConfigure.razor</c>.</returns>
|
|
internal static string ReadMarkup()
|
|
{
|
|
var dir = AppContext.BaseDirectory;
|
|
for (var i = 0; i < 6 && dir is not null; i++) dir = Directory.GetParent(dir)?.FullName;
|
|
return File.ReadAllText(Path.Combine(dir!, "src", "ZB.MOM.WW.ScadaBridge.CentralUI",
|
|
"Components", "Pages", "Deployment", "InstanceConfigure.razor"));
|
|
}
|
|
|
|
private static string Markup => ReadMarkup();
|
|
|
|
/// <summary>Verifies that binding rows come from the flattened configuration rather than the template attributes.</summary>
|
|
[Fact]
|
|
public void BindingRows_ComeFromFlattenedConfiguration_NotTemplateAttributes()
|
|
{
|
|
var m = Markup;
|
|
Assert.Contains("LoadBindingRowsAsync", m);
|
|
Assert.Contains("BindingGroupBuilder.Build(", m);
|
|
// The old direct-attribute projection must be gone from the bindings path.
|
|
Assert.DoesNotContain("_bindingDataSourceAttrs = attrs.Where(a => !string.IsNullOrEmpty(a.DataSourceReference))", m);
|
|
Assert.Contains("DefaultDataSourceReference", m);
|
|
}
|
|
|
|
/// <summary>Verifies that binding rows fall back to direct attributes with a warning banner when flattening fails.</summary>
|
|
[Fact]
|
|
public void BindingRows_FallBackToDirectAttributes_WithBanner_WhenFlattenFails()
|
|
{
|
|
var m = Markup;
|
|
Assert.Contains("_bindingSourceWarning", m);
|
|
Assert.Contains("data-test=\"binding-source-warning\"", m);
|
|
}
|
|
|
|
/// <summary>Verifies that save and test cover every binding row.</summary>
|
|
[Fact]
|
|
public void SaveAndTest_CoverEveryRow()
|
|
{
|
|
var m = Markup.Replace("\r\n", "\n");
|
|
// Save posts the whole selection dictionary (hidden-row survival property).
|
|
Assert.Contains("_bindingSelections\n .Select(kv => new ConnectionBinding(", m);
|
|
// Test Bindings iterates the grouped rows, not the legacy attr list.
|
|
Assert.Contains("foreach (var g in _bindingGroups)", m);
|
|
}
|
|
}
|