From: Alexander Köplinger Date: Wed, 19 Apr 2017 19:04:47 +0000 (+0200) Subject: [corlib/System.Data] Test fixes for xammac 4.5 and watchos X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=ceabda8a54b2580a1cd1feb7d01996c083ac92c3;p=mono.git [corlib/System.Data] Test fixes for xammac 4.5 and watchos The TrimSpecial() method and Windows-specific code was removed from xammac 4.5 so reflection can't find it anymore, handle this case. Also add a workaround for SqlParameterCollectionTest.CopyToTest() which fails on watchos since the SqlCommand would throw a PNSE. It's a workaround because it just makes the test ignored since we don't set the env var that ConnectionManager.Instance.Sql reads in XI tests, but it makes the test consistent with the other tests in the suite. We should fix this properly later on. --- diff --git a/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterCollectionTest.cs b/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterCollectionTest.cs index ccb6e197d3c..48181ca6b19 100644 --- a/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterCollectionTest.cs +++ b/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterCollectionTest.cs @@ -41,6 +41,14 @@ namespace MonoTests.System.Data.Connected.SqlClient public class SqlParameterCollectionTest { + EngineConfig engine; + + [SetUp] + public void SetUp () + { + engine = ConnectionManager.Instance.Sql.EngineConfig; + } + [Test] public void CopyToTest () { diff --git a/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs b/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs index d25889f6de6..2935c259db2 100644 --- a/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs +++ b/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs @@ -867,9 +867,12 @@ namespace MonoTests.System [Test] public void WindowsRegistryTimezoneWithParentheses () { - var method = (MethodInfo) typeof (TimeZoneInfo).GetMember ("TrimSpecial", MemberTypes.Method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)[0]; + var memberInfos = typeof (TimeZoneInfo).GetMember ("TrimSpecial", MemberTypes.Method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); - var name = method.Invoke (null, new object [] { " <---> Central Standard Time (Mexico) ||<<>>" }); + if (memberInfos.Length == 0) + Assert.Ignore ("TrimSpecial method not found"); + + var name = ((MethodInfo)memberInfos[0]).Invoke (null, new object [] { " <---> Central Standard Time (Mexico) ||<<>>" }); Assert.AreEqual (name, "Central Standard Time (Mexico)", "#1"); } #endif