[System] Skip loopback interfaces in the FirstInterfaceOperationalStatus() test
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 19 Jan 2015 09:30:29 +0000 (10:30 +0100)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 19 Jan 2015 09:30:29 +0000 (10:30 +0100)
The status of loopback interfaces is always 'Unknown' on Linux.
This fails the test so we need to skip them.

mcs/class/System/Test/System.Net.NetworkInformation/NetworkInterfaceTest.cs

index 315f3564abf466b78e5de7d4c5de13abfd965867..c8ac935e02c1e51192ca1ba82fc2948d2233818e 100644 (file)
@@ -7,6 +7,7 @@
 
 using NUnit.Framework;
 using System;
+using System.Linq;
 using System.Net;
 using System.Net.NetworkInformation;
 
@@ -59,8 +60,9 @@ namespace MonoTests.System.Net.NetworkInformation
                [Test]
                public void FirstInterfaceOperationalStatus ()
                {
-                       NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces ();
-                       Assert.AreNotEqual (adapters[0].OperationalStatus, OperationalStatus.Unknown);
+                       // skip the loopback interface, it doesn't support OperationalStatus on Linux
+                       var adapter = NetworkInterface.GetAllNetworkInterfaces ().First (x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback);
+                       Assert.AreNotEqual (adapter.OperationalStatus, OperationalStatus.Unknown);
                }
        
                [Test]