提交 ceabda8a 编写于 作者: A Alexander Köplinger

[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.
上级 4472be61
......@@ -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 ()
{
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册