// Copyright 2020-2025 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Mirrors server/jetstream_errors_test.go in the NATS server Go source. // // All 4 tests are deferred: // T:1381 — TestIsNatsErr: uses IsNatsErr(error, ...) where the Go version accepts // arbitrary error interface values (including plain errors.New("x") which // evaluates to false). The .NET JsApiErrors.IsNatsError only accepts JsApiError? // and the "NewJS*" factory constructors (NewJSRestoreSubscribeFailedError etc.) // that populate Description templates from tags have not been ported yet. // T:1382 — TestApiError_Error: uses ApiErrors[JSClusterNotActiveErr].Error() — the Go // ApiErrors map and per-error .Error() method (returns "description (errCode)") // differs from the .NET JsApiErrors.ClusterNotActive.ToString() convention. // T:1383 — TestApiError_NewWithTags: uses NewJSRestoreSubscribeFailedError with tag // substitution — factory constructors not yet ported. // T:1384 — TestApiError_NewWithUnless: uses NewJSStreamRestoreError, Unless() helper, // NewJSPeerRemapError — not yet ported. namespace ZB.MOM.NatsNet.Server.Tests.JetStream; /// /// Tests for JetStream API error types and IsNatsErr helper. /// Mirrors server/jetstream_errors_test.go. /// All tests deferred pending port of Go factory constructors and tag-substitution system. /// public sealed class JetStreamErrorsTests { [Fact(Skip = "deferred: NewJS* factory constructors and IsNatsErr(error) not yet ported")] // T:1381 public void IsNatsErr_ShouldSucceed() { } [Fact(Skip = "deferred: ApiErrors map and .Error() method not yet ported")] // T:1382 public void ApiError_Error_ShouldSucceed() { } [Fact(Skip = "deferred: NewJSRestoreSubscribeFailedError with tag substitution not yet ported")] // T:1383 public void ApiError_NewWithTags_ShouldSucceed() { } [Fact(Skip = "deferred: NewJSStreamRestoreError / Unless() helper not yet ported")] // T:1384 public void ApiError_NewWithUnless_ShouldSucceed() { } }