System.Net.NetworkInformation.Tests.NetworkInterfaceBasicTest.BasicTest_AccessInstanceProperties_NoExceptions_Linux C# (CSharp) Method

BasicTest_AccessInstanceProperties_NoExceptions_Linux() private method

        public void BasicTest_AccessInstanceProperties_NoExceptions_Linux()
        {
            foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                _log.WriteLine("- NetworkInterface -");
                _log.WriteLine("Name: " + nic.Name);
                string description = nic.Description;
                Assert.False(string.IsNullOrEmpty(description), "NetworkInterface.Description should not be null or empty.");
                _log.WriteLine("Description: " + description);
                string id = nic.Id;
                Assert.False(string.IsNullOrEmpty(id), "NetworkInterface.Id should not be null or empty.");
                _log.WriteLine("ID: " + id);
                Assert.Throws<PlatformNotSupportedException>(() => nic.IsReceiveOnly);
                _log.WriteLine("Type: " + nic.NetworkInterfaceType);
                _log.WriteLine("Status: " + nic.OperationalStatus);

                try
                {
                    _log.WriteLine("Speed: " + nic.Speed);
                    Assert.InRange(nic.Speed, -1, long.MaxValue);
                }
                // We cannot guarantee this works on all devices.
                catch (PlatformNotSupportedException pnse)
                {
                    _log.WriteLine(pnse.ToString());
                }

                _log.WriteLine("SupportsMulticast: " + nic.SupportsMulticast);
                _log.WriteLine("GetPhysicalAddress(): " + nic.GetPhysicalAddress());
            }
        }