feat(commons): HandshakePhase + HandshakeResult for the reset-aware handshake (#36)

Claude-Session: https://claude.ai/code/session_01XPsuy2ZZ5Gbyfpt8PrK5BV
This commit is contained in:
Joseph Doherty
2026-09-10 15:18:10 -04:00
parent 9bb373c4a1
commit e5c536c6b7
3 changed files with 74 additions and 0 deletions
@@ -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);
}
}