// Copyright 2012-2026 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.
using Xunit.Abstractions;
namespace ZB.MOM.NatsNet.Server.IntegrationTests;
///
/// Abstract base class for all integration tests.
/// Skips the entire test class if the server cannot boot (i.e., the .NET server
/// runtime is not yet complete). Individual test classes inherit from this class.
///
[Trait("Category", "Integration")]
public abstract class IntegrationTestBase : IDisposable
{
// =========================================================================
// Constructor — Skip guard
// =========================================================================
///
/// Initializes the test base and verifies that the server can boot.
/// If returns false the test
/// is skipped via Xunit.SkippableFact's Skip.If mechanism.
///
protected IntegrationTestBase(ITestOutputHelper output)
{
Output = output;
Skip.If(!Helpers.TestServerHelper.CanBoot(), "Server cannot boot — skipping integration tests.");
}
// =========================================================================
// Protected members
// =========================================================================
/// xUnit output helper, available to derived test classes.
protected ITestOutputHelper Output { get; }
// =========================================================================
// IDisposable
// =========================================================================
///
/// Override in subclasses to perform per-test cleanup (e.g., shut down servers,
/// delete temp dirs). The base implementation does nothing.
///
public virtual void Dispose() { }
}