@@ -60,6 +60,25 @@ internal class FakeAbLegacyTag : IAbLegacyTagRuntime
|
||||
return Value;
|
||||
}
|
||||
public virtual void EncodeValue(AbLegacyDataType type, int? bitIndex, object? value) => Value = value;
|
||||
|
||||
/// <summary>
|
||||
/// PR 7 — array contiguous-block element decoder. Tests seed <see cref="ArrayValues"/>
|
||||
/// with the per-index payload; the fake then returns each element in order. Falls back
|
||||
/// to <see cref="Value"/> when the test only seeded a scalar (Convert.ChangeType handles
|
||||
/// the cast back to the requested element type in the driver's BuildArray helper).
|
||||
/// </summary>
|
||||
public IReadOnlyList<object?>? ArrayValues { get; set; }
|
||||
public AbLegacyDataType? LastArrayDecodeType { get; private set; }
|
||||
public int LastArrayDecodeMaxIndex { get; private set; } = -1;
|
||||
public virtual object? DecodeArrayElement(AbLegacyDataType type, int elementIndex)
|
||||
{
|
||||
LastArrayDecodeType = type;
|
||||
if (elementIndex > LastArrayDecodeMaxIndex) LastArrayDecodeMaxIndex = elementIndex;
|
||||
if (ArrayValues is not null && elementIndex < ArrayValues.Count)
|
||||
return ArrayValues[elementIndex];
|
||||
return Value;
|
||||
}
|
||||
|
||||
public virtual void Dispose() => Disposed = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user