feat(commons): HandshakePhase + HandshakeResult for the reset-aware handshake (#36)
Claude-Session: https://claude.ai/code/session_01XPsuy2ZZ5Gbyfpt8PrK5BV
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Types;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Gitea #36: <see cref="HandshakeResult"/> lets a script tell WHICH leg of a reset-aware
|
||||
/// handshake failed without naming the <see cref="HandshakePhase"/> enum (script bodies
|
||||
/// import only System/System.Collections.Generic/System.Linq/System.Threading.Tasks).
|
||||
/// </summary>
|
||||
public class HandshakeResultTests
|
||||
{
|
||||
[Fact]
|
||||
public void ResetFailed_IsTrue_OnlyForAnUnmatchedResetPhase()
|
||||
{
|
||||
var resetTimeout = new HandshakeResult(false, null, null, true, HandshakePhase.Reset, "reset timed out");
|
||||
var responseTimeout = new HandshakeResult(false, null, null, true, HandshakePhase.Response, "response timed out");
|
||||
var matched = new HandshakeResult(true, true, "Good", false, HandshakePhase.Response, null);
|
||||
|
||||
Assert.True(resetTimeout.ResetFailed);
|
||||
Assert.False(responseTimeout.ResetFailed);
|
||||
Assert.False(matched.ResetFailed);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user