using System.Text; using Heimdall.Agent.Services; using Microsoft.Extensions.Logging.Abstractions; using Shouldly; namespace Heimdall.Agent.Tests; public class HomeKitMdnsProbeTests { [Fact] public async Task DiscoverAsync_NoDevices_ReturnsEmptyWithoutThrow() { var probe = new HomeKitMdnsProbe(NullLogger.Instance); using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); // In a container without a multicast route this returns [] — it must // never throw and must terminate within the window. var devices = await probe.DiscoverAsync(cts.Token); devices.ShouldNotBeNull(); } [Fact] public void Constructor_AcceptsLogger() { var probe = new HomeKitMdnsProbe(NullLogger.Instance); probe.ShouldNotBeNull(); } [Fact] public void Constructor_AcceptsMdnsClientAndLogger() { // The probe can be constructed with an IMdnsClient and logger // This tests the secondary constructor var probe = new HomeKitMdnsProbe(NullLogger.Instance); probe.ShouldNotBeNull(); } }