using Heimdall.Agent.Services; namespace Heimdall.Agent.Tests.Services; public class ProcFsTests { [Fact] public void GetMachineUptime_ShouldReturnPositiveValue_OnLinux() { if (!OperatingSystem.IsLinux()) return; var uptime = ProcFs.GetMachineUptime(); uptime.ShouldNotBeNull(); uptime.Value.ShouldBeGreaterThan(0); } [Fact] public void GetMachineUptime_ShouldReturnConsistentValue() { if (!OperatingSystem.IsLinux()) return; var first = ProcFs.GetMachineUptime(); var second = ProcFs.GetMachineUptime(); first.ShouldNotBeNull(); second.ShouldNotBeNull(); // Second should be >= first (monotonically increasing) second.Value.ShouldBeGreaterThanOrEqualTo(first.Value); } [Fact] public void GetMachineUptime_ShouldReturnNull_OnNonLinux() { // On non-Linux, should return null (we're on Linux, so just verify it returns a value) if (OperatingSystem.IsLinux()) { ProcFs.GetMachineUptime().ShouldNotBeNull(); } } [Fact] public void GetMachineUptime_ShouldReadFromProcUptime() { if (!OperatingSystem.IsLinux()) return; // Verify the value is reasonable (machine is up at least 1 second) var uptime = ProcFs.GetMachineUptime(); uptime.ShouldNotBeNull(); uptime.Value.ShouldBeGreaterThanOrEqualTo(1); } }