diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs index 4c1c048..c950e55 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/AuthHandlerTests.cs @@ -12,6 +12,7 @@ // limitations under the License. using Shouldly; +using ZB.MOM.NatsNet.Server; using ZB.MOM.NatsNet.Server.Auth; namespace ZB.MOM.NatsNet.Server.Tests.Auth; @@ -381,4 +382,68 @@ public class AuthHandlerTests { AuthHandler.ConnectionTypes.IsKnown(ct).ShouldBe(expected); } + + // ========================================================================= + // GetAuthErrClosedState — Go test ID 153 (T:153) + // Mirrors the closed-state logic exercised by TestAuthProxyRequired. + // (The full Go test is server-dependent; this covers the pure unit subset.) + // ========================================================================= + + /// + /// Mirrors the proxy-required branch of TestAuthProxyRequired (T:153). + /// + [Fact] // T:153 + public void GetAuthErrClosedState_ProxyRequired_ReturnsProxyRequired() + { + var state = AuthHandler.GetAuthErrClosedState(new AuthProxyRequiredException()); + state.ShouldBe(ClosedState.ProxyRequired); + } + + [Fact] + public void GetAuthErrClosedState_ProxyNotTrusted_ReturnsProxyNotTrusted() + { + var state = AuthHandler.GetAuthErrClosedState(new AuthProxyNotTrustedException()); + state.ShouldBe(ClosedState.ProxyNotTrusted); + } + + [Fact] + public void GetAuthErrClosedState_OtherException_ReturnsAuthenticationViolation() + { + var state = AuthHandler.GetAuthErrClosedState(new InvalidOperationException("bad")); + state.ShouldBe(ClosedState.AuthenticationViolation); + } + + [Fact] + public void GetAuthErrClosedState_NullException_ReturnsAuthenticationViolation() + { + var state = AuthHandler.GetAuthErrClosedState(null); + state.ShouldBe(ClosedState.AuthenticationViolation); + } + + // ========================================================================= + // ValidateProxies + // ========================================================================= + + [Fact] + public void ValidateProxies_ProxyRequiredWithoutProxyProtocol_ReturnsError() + { + var opts = new ServerOptions { ProxyRequired = true, ProxyProtocol = false }; + var err = AuthHandler.ValidateProxies(opts); + err.ShouldNotBeNull(); + err!.Message.ShouldContain("proxy_required"); + } + + [Fact] + public void ValidateProxies_ProxyRequiredWithProxyProtocol_ReturnsNull() + { + var opts = new ServerOptions { ProxyRequired = true, ProxyProtocol = true }; + AuthHandler.ValidateProxies(opts).ShouldBeNull(); + } + + [Fact] + public void ValidateProxies_NeitherSet_ReturnsNull() + { + var opts = new ServerOptions(); + AuthHandler.ValidateProxies(opts).ShouldBeNull(); + } } diff --git a/porting.db b/porting.db index 96f9e57..4e1ba21 100644 Binary files a/porting.db and b/porting.db differ diff --git a/reports/current.md b/reports/current.md index d3c67b6..28f7551 100644 --- a/reports/current.md +++ b/reports/current.md @@ -1,6 +1,6 @@ # NATS .NET Porting Status Report -Generated: 2026-02-27 00:04:02 UTC +Generated: 2026-02-27 00:07:45 UTC ## Modules (12 total) @@ -21,11 +21,11 @@ Generated: 2026-02-27 00:04:02 UTC | Status | Count | |--------|-------| -| complete | 208 | -| deferred | 162 | +| complete | 209 | +| deferred | 201 | | n_a | 187 | | not_started | 2527 | -| stub | 59 | +| stub | 19 | | verified | 114 | ## Library Mappings (36 total) @@ -37,4 +37,4 @@ Generated: 2026-02-27 00:04:02 UTC ## Overall Progress -**4193/6942 items complete (60.4%)** +**4194/6942 items complete (60.4%)** diff --git a/reports/report_91f86b9.md b/reports/report_91f86b9.md new file mode 100644 index 0000000..28f7551 --- /dev/null +++ b/reports/report_91f86b9.md @@ -0,0 +1,40 @@ +# NATS .NET Porting Status Report + +Generated: 2026-02-27 00:07:45 UTC + +## Modules (12 total) + +| Status | Count | +|--------|-------| +| not_started | 1 | +| verified | 11 | + +## Features (3673 total) + +| Status | Count | +|--------|-------| +| complete | 3368 | +| n_a | 26 | +| verified | 279 | + +## Unit Tests (3257 total) + +| Status | Count | +|--------|-------| +| complete | 209 | +| deferred | 201 | +| n_a | 187 | +| not_started | 2527 | +| stub | 19 | +| verified | 114 | + +## Library Mappings (36 total) + +| Status | Count | +|--------|-------| +| mapped | 36 | + + +## Overall Progress + +**4194/6942 items complete (60.4%)**