Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions tests/ARSAS.Tests/Iec61850ReportPlannerRegressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,36 @@ public void BuildPlans_FastPointWithoutStaticCoverage_BecomesDynamicCandidate()
Assert.Contains(point, plan.Bindings);
}

[Fact]
public void BuildPlans_SlowMeasurementWithoutStaticCoverage_BecomesDynamicCandidate()
{
var device = BuildDevice();
var point = BuildSlowMeasurementPoint(device);

var plans = Iec61850ReportPlanner.BuildPlans(device, new[] { point });

var plan = Assert.Single(plans);
Assert.Equal("Dynamic candidate", plan.Status);
Assert.True(plan.AllowDynamicDataSetWrites);
Assert.Contains(point, plan.Bindings);
}

[Fact]
public void BuildPlans_AllUncoveredPoints_AppearExactlyOnceInDynamicCandidates()
{
var device = BuildDevice();
var fast = BuildFastStatusPoint(device);
var slow = BuildSlowMeasurementPoint(device);

var plans = Iec61850ReportPlanner.BuildPlans(device, new[] { fast, slow });

Assert.All(plans, plan => Assert.Equal("Dynamic candidate", plan.Status));
var bindings = plans.SelectMany(plan => plan.Bindings).ToArray();
Assert.Equal(2, bindings.Length);
Assert.Single(bindings, point => point.PointKey == fast.PointKey);
Assert.Single(bindings, point => point.PointKey == slow.PointKey);
}

[Fact]
public void BuildDynamicFallbackPlans_FastPoint_IsNotExcludedByPollingInterval()
{
Expand Down Expand Up @@ -70,4 +100,18 @@ private static Iec61850MonitorPoint BuildFastStatusPoint(Iec61850MonitorDevice d
Category = "Position",
PollingIntervalMs = 250
};

private static Iec61850MonitorPoint BuildSlowMeasurementPoint(Iec61850MonitorDevice device)
=> new()
{
DeviceId = device.DeviceId,
DeviceName = device.Name,
IpAddress = device.IpAddress,
SignalName = "Phase A current",
IecReference = "IED1LD0/MMXU1.A.phsA.cVal.mag.f",
FunctionalConstraint = "MX",
IecDataType = "Float32",
Category = "Measurement",
PollingIntervalMs = 2000
};
}
Loading