using Mbproxy.Diagnostics;
using Serilog;
using Shouldly;
using Xunit;

namespace Mbproxy.Tests.Diagnostics;

/// <summary>
/// Unit tests for <see cref="SyslogBridge"/>. The bridge's fail-safe contract is that
/// attaching the local-syslog sink and building the resulting logger never throw —
/// even on a host with no <c>/dev/log</c> (e.g. the Windows test leg), where the sink
/// connects lazily and degrades silently.
/// </summary>
[Trait("Category", "Unit")]
public sealed class SyslogBridgeTests
{
    [Fact]
    public void AttachTo_ReturnsAConfiguration_AndNeverThrows()
        => SyslogBridge.AttachTo(new LoggerConfiguration()).ShouldNotBeNull();

    [Fact]
    public void AttachTo_ResultCreatesALogger_WithoutThrowing()
    {
        using var logger = SyslogBridge.AttachTo(new LoggerConfiguration()).CreateLogger();
        logger.ShouldNotBeNull();
    }
}
