Пример #1
0
        public WinOSInfo GetWinInfo(bool format = false)
        {
            var winOSInfo = new WinOSInfo();

            winOSInfo = WinOSInformation.GetInfoProcessor(winOSInfo);
            winOSInfo = WinOSInformation.GetInfoMemory(winOSInfo);
            winOSInfo = WinOSInformation.GetInfoDisk(winOSInfo);
            winOSInfo = WinOSInformation.GetInfoEthernet(winOSInfo);

            if (format)
            {
                var netFormat = winOSInfo.Networks
                                .Select(x =>
                {
                    x.Speed = Formatter.FormatSpeedNet(x.Speed); return(x);
                })
                                .ToList();

                winOSInfo.Networks = netFormat;
            }

            winOSInfo = WinOSInformation.GetInfoGPU(winOSInfo);
            winOSInfo = WinOSInformation.GetInfoOS(winOSInfo);
            winOSInfo = WinOSInformation.GetInfoProcesses(winOSInfo);
            winOSInfo = WinOSInformation.GetInfoServices(winOSInfo);

            return(winOSInfo);
        }
Пример #2
0
        public string SendDataServerCentral(WinOSInfo winos)
        {
            var client = new HttpProvider(_urlServer);
            var result = client.SendPostJson <WinOSInfo>(_urlEndPoint, winos).Result;

            Console.WriteLine("Status {0} Hour {1} ", result, DateTimeOffset.UtcNow);
            return(result);
        }
Пример #3
0
        public void GetInfoMemory_ReturnDecimalLargerZero()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoMemory(winos);

            Assert.True(result.MemorySize > 0);
            Assert.True(result.MemoryAvailable > 0);
            Assert.True(result.MemoryAvailableVertual > 0);
            Assert.True(result.MemoryVirtualSize > 0);
        }
Пример #4
0
        public void GetInfoProcessor_ReturnsDataFormatString()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoProcessor(winos);

            Assert.NotEmpty(result.ProcessorArchitecture);
            Assert.NotEmpty(result.ProcessorIden);
            Assert.NotEmpty(result.ProcessorLevel);
            Assert.NotEmpty(result.ProcessorNumber);
        }
Пример #5
0
        public void GetInfoOS_ReturnDataCorrectGetInfoOS()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoOS(winos);

            var first = result.OSInfos.FirstOrDefault();

            Assert.NotNull(result.OSInfos);
            Assert.NotNull(first.OperationName);
            Assert.NotNull(first.OperationArchitecture);
        }
Пример #6
0
        public void GetInfoProcesses_ReturnDataCorrectGetInfoProcesses()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoProcesses(winos);

            Assert.NotNull(result.OSInfoProcesses);
            Assert.NotEmpty(result.OSInfoProcesses);

            foreach (var item in winos.OSInfoProcesses)
            {
                Assert.True(item.ProcessId > -1);
                Assert.NotNull(item.ProcessName);
                Assert.NotNull(item.Status);
            }
        }
Пример #7
0
        public void GetInfoEthernet_ReturnDataCorrectInfoEthernet()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoEthernet(winos);

            var first = result.Networks.FirstOrDefault();

            Assert.True(result.ExistsConnection);
            Assert.NotNull(result.Networks);
            Assert.Equal(NetworkInterface.GetAllNetworkInterfaces().Count(), result.Networks.Count);
            Assert.NotNull(first.Name);
            Assert.NotNull(first.NetworkType);
            Assert.NotNull(first.Status);
            Assert.NotNull(first.Description);
            Assert.NotNull(first.Speed);
        }
Пример #8
0
        public void GetInfoServices_ReturnDataCorrectGetInfoServices()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoServices(winos);

            Assert.NotNull(result.OSInfoServices);

            foreach (var item in result.OSInfoServices)
            {
                Assert.NotNull(item.Name);
                Assert.NotNull(item.ServiceName);
                Assert.NotNull(item.ServicesType);
                Assert.NotNull(item.StartType);
                Assert.NotNull(item.Status);
            }
        }
Пример #9
0
        public void GetInfoDisk_ReturnDataCorrectInfoDisks()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoDisk(winos);

            var first = result.Disks.FirstOrDefault();

            var di = DriveInfo.GetDrives().Where(x => x.IsReady).ToList();

            Assert.NotNull(result.Disks);
            Assert.Equal(result.LogicalDisksCount, Directory.GetLogicalDrives().Length);
            Assert.Equal(di.Count, result.Disks.Count);
            Assert.NotNull(first.Name);
            Assert.True(first.TotalSize > 0);
            Assert.True(first.FreeSize > 0);
            Assert.NotNull(first.Format);
            Assert.NotNull(first.RootDirectory);
        }
Пример #10
0
        public void GetInfoGPU_ReturnDataCorrectGetInfoGPU()
        {
            var winos  = new WinOSInfo();
            var result = WinOSInformation.GetInfoGPU(winos);

            var first = result.GPUs.FirstOrDefault();

            Assert.NotNull(result.GPUs);
            Assert.NotNull(first.Name);
            Assert.NotNull(first.Status);
            Assert.NotNull(first.Caption);
            Assert.NotNull(first.DeviceID);
            Assert.True(first.AdapterRAM > 0);
            Assert.NotNull(first.AdapterDACType);
            Assert.NotNull(first.InstalledDisplayDrivers);
            Assert.NotNull(first.DriverVersion);
            Assert.NotNull(first.VideoProcessor);
            Assert.True(first.VideoArchitecture > 0);
            Assert.True(first.VideoMemoryType > 0);
        }