using System;
using Xunit;
using CncService.Interface;
using CncService.Impl;

namespace CncService.Tests
{
    public class WindowsServiceCheckerTests
    {
        [Fact]
        public void GetServiceStatus_NotInstalled_ForUnknownService()
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT) return;
            var checker = new WindowsServiceChecker();
            var status = checker.GetServiceStatus("DefinitelyNotExistService_UnitTest");
            Assert.Equal(ServiceStatusEnum.NotInstalled, status);
        }

        [Fact]
        public void TryStartService_NotInstalled_ReturnsNotInstalled()
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT) return;
            var checker = new WindowsServiceChecker();
            var (ok, msg) = checker.TryStartService("DefinitelyNotExistService_UnitTest", 5);
            Assert.False(ok);
            Assert.Contains("NotInstalled", msg);
        }
    }
}
