Files
Heimdall/tests/Heimdall.Agent.Tests/HomeKitMdnsProbeTests.cs
T

38 lines
1.1 KiB
C#
Raw Normal View History

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<HomeKitMdnsProbe>.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<HomeKitMdnsProbe>.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<HomeKitMdnsProbe>.Instance);
probe.ShouldNotBeNull();
}
}