fix(dcl): remove unused poll-based WriteBatchAndWaitAsync from IDataConnection and both adapters (review 2026-10-21 02/U3)
This commit is contained in:
-7
@@ -163,13 +163,6 @@ public sealed class FakeBatchDataConnection
|
||||
=> Task.FromResult<IReadOnlyDictionary<string, WriteResult>>(
|
||||
values.ToDictionary(kv => kv.Key, _ => new WriteResult(true, null)));
|
||||
|
||||
// Fake behaviour: Reports that the handshake matched without writing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<bool> WriteBatchAndWaitAsync(
|
||||
IDictionary<string, object?> values, string flagPath, object? flagValue, string responsePath,
|
||||
object? responseValue, TimeSpan timeout, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(true);
|
||||
|
||||
// Fake behaviour: Captures the alarm callback and returns a generated subscription id.
|
||||
/// <inheritdoc />
|
||||
public Task<string> SubscribeAlarmsAsync(
|
||||
|
||||
-53
@@ -186,59 +186,6 @@ public class MxGatewayDataConnectionTests
|
||||
Assert.Equal("rejected", r.ErrorMessage);
|
||||
}
|
||||
|
||||
// ── WriteBatchAndWait ──
|
||||
|
||||
/// <summary>Verifies that a batch write and wait returns true when the response value matches.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task WriteBatchAndWait_returns_true_when_response_matches()
|
||||
{
|
||||
var writeCalls = new List<string>();
|
||||
var fake = new FakeMxGatewayClient
|
||||
{
|
||||
WriteHandler = writes =>
|
||||
{
|
||||
writeCalls.AddRange(writes.Select(w => w.TagPath));
|
||||
return writes.Select(w => new MxWriteOutcome(w.TagPath, true, null)).ToList();
|
||||
},
|
||||
// Response path already reads the expected value.
|
||||
ReadHandler = tags => tags.Select(t =>
|
||||
new MxReadOutcome(t, true, "DONE", QualityCode.Good, DateTimeOffset.UtcNow, null)).ToList()
|
||||
};
|
||||
var adapter = NewAdapter(fake);
|
||||
await adapter.ConnectAsync(Details());
|
||||
|
||||
var ok = await adapter.WriteBatchAndWaitAsync(
|
||||
new Dictionary<string, object?> { ["V"] = 1 }, "Flag", 1, "Resp", "DONE",
|
||||
TimeSpan.FromSeconds(5));
|
||||
|
||||
Assert.True(ok);
|
||||
// Values written before the flag, and the flag itself.
|
||||
Assert.Contains("V", writeCalls);
|
||||
Assert.Contains("Flag", writeCalls);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a batch write and wait returns false on timeout.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task WriteBatchAndWait_returns_false_on_timeout()
|
||||
{
|
||||
var fake = new FakeMxGatewayClient
|
||||
{
|
||||
WriteHandler = writes => writes.Select(w => new MxWriteOutcome(w.TagPath, true, null)).ToList(),
|
||||
ReadHandler = tags => tags.Select(t =>
|
||||
new MxReadOutcome(t, true, "NEVER", QualityCode.Good, DateTimeOffset.UtcNow, null)).ToList()
|
||||
};
|
||||
var adapter = NewAdapter(fake);
|
||||
await adapter.ConnectAsync(Details());
|
||||
|
||||
var ok = await adapter.WriteBatchAndWaitAsync(
|
||||
new Dictionary<string, object?> { ["V"] = 1 }, "Flag", 1, "Resp", "DONE",
|
||||
TimeSpan.FromMilliseconds(300));
|
||||
|
||||
Assert.False(ok);
|
||||
}
|
||||
|
||||
// ── browse ──
|
||||
|
||||
/// <summary>Verifies that browsing children maps the children and the truncated flag.</summary>
|
||||
|
||||
@@ -152,14 +152,6 @@ public sealed class SimulatedDataConnection : IDataConnection, IBatchSubscribabl
|
||||
return Task.FromResult<IReadOnlyDictionary<string, WriteResult>>(results);
|
||||
}
|
||||
|
||||
// Accepts the batch and reports that the awaited response matched immediately.
|
||||
/// <inheritdoc />
|
||||
public Task<bool> WriteBatchAndWaitAsync(
|
||||
IDictionary<string, object?> values, string flagPath, object? flagValue,
|
||||
string responsePath, object? responseValue, TimeSpan timeout,
|
||||
CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(true);
|
||||
|
||||
/// <summary>Releases the connection; the simulated connection holds no resources.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
||||
|
||||
Reference in New Issue
Block a user