As described in https://bugzilla.xamarin.com/show_bug.cgi?id=34883 at
least Samsung SG3 doesn't allow access to the local network
interface (in fact, even ifconfig doesn't work on the device). Therefore
the test needs to be disabled on those devices. This is the first part
of the fix, the second one will be implemented in Xamarin.Android test
suite which will provide the AndroidShouldPingWork method which will
check the device id against list of those that do not work for this
test.
Part #1 of fix for https://bugzilla.xamarin.com/show_bug.cgi?id=34883
namespace MonoTests.System.Net.NetworkInformation
{
[TestFixture]
- public class PingTest
+ public partial class PingTest
{
- [Test]
+ partial void AndroidShouldPingWork (ref bool shouldWork);
+
+ [Test]
public void PingFail()
{
#if MONOTOUCH
#if MONOTOUCH
Assert.Ignore ("Ping implementation is broken on MT (requires sudo access)");
#else
- var p = new Ping ().Send ("127.0.0.1");
- Assert.AreEqual(IPStatus.Success, p.Status);
+ bool shouldWork = true;
+ AndroidShouldPingWork (ref shouldWork);
+ if (shouldWork) {
+ var p = new Ping ().Send ("127.0.0.1");
+ Assert.AreEqual(IPStatus.Success, p.Status);
+ } else
+ Assert.Ignore ("Ping will not work on this Android device");
#endif
}