using S7DataItem = global::S7.Net.Types.DataItem;
using S7NetDataType = global::S7.Net.DataType;
using VarType = global::S7.Net.VarType;
namespace ZB.MOM.WW.OtOpcUa.Driver.S7.Tests;
///
/// A scriptable : every connection it creates delegates its wire
/// operations to the factory's handlers, so a test scripts the device once and observes every
/// connection (including reopened ones). Counts wire operations so a test can prove what did
/// NOT go to the wire without timing anything.
///
internal sealed class ScriptedS7PlcFactory : IS7PlcFactory
{
private int _wireOps;
/// Every connection created, in order.
public List Created { get; } = [];
/// Wire operations issued (reads, multi-var reads, writes; not opens or status probes).
public int WireOps => Volatile.Read(ref _wireOps);
/// Hook run inside every ; the default opens immediately.
public Func Open { get; set; } = (_, _) => Task.CompletedTask;
/// Per-address string read; the default returns (ushort)42.
public Func> Read { get; set; } = (_, _) => Task.FromResult