You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
69
mcs/class/corlib/Test/Mono/NativePlatformTest.cs
Normal file
69
mcs/class/corlib/Test/Mono/NativePlatformTest.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using Mono;
|
||||
|
||||
namespace MonoTests.Mono
|
||||
{
|
||||
[TestFixture]
|
||||
public class NativePlatformTest
|
||||
{
|
||||
#if WIN_PLATFORM
|
||||
[TestFixtureSetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Assert.Ignore ("Mono.Native is not supported on this platform.");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void PlatformType ()
|
||||
{
|
||||
var type = MonoNativePlatform.GetPlatformType ();
|
||||
Assert.That ((int)type, Is.GreaterThan (0), "platform type");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInitialize ()
|
||||
{
|
||||
MonoNativePlatform.Initialize ();
|
||||
var initialized = MonoNativePlatform.IsInitialized ();
|
||||
Assert.IsTrue (initialized, "MonoNativePlatform.IsInitialized()");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReflectionInitialize ()
|
||||
{
|
||||
var asm = typeof (string).Assembly;
|
||||
var type = asm.GetType ("Mono.MonoNativePlatform");
|
||||
Assert.IsNotNull (type, "MonoNativePlatform");
|
||||
|
||||
var method = type.GetMethod ("Initialize", BindingFlags.Static | BindingFlags.Public);
|
||||
Assert.IsNotNull (method, "MonoNativePlatform.Initialize");
|
||||
|
||||
var method2 = type.GetMethod ("IsInitialized", BindingFlags.Static | BindingFlags.Public);
|
||||
Assert.IsNotNull (method2, "MonoNativePlatform.IsInitialized");
|
||||
|
||||
method.Invoke (null, null);
|
||||
|
||||
var result = (bool)method2.Invoke (null, null);
|
||||
Assert.IsTrue (result, "MonoNativePlatform.IsInitialized()");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInternalCounter ()
|
||||
{
|
||||
MonoNativePlatform.Initialize ();
|
||||
|
||||
var asm = typeof (string).Assembly;
|
||||
var type = asm.GetType ("Mono.MonoNativePlatform");
|
||||
Assert.IsNotNull (type, "MonoNativePlatform");
|
||||
|
||||
var method = type.GetMethod ("TestInternalCounter", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
Assert.IsNotNull (method, "MonoNativePlatform.TestInternalCounter");
|
||||
var result = method.Invoke (null, null);
|
||||
|
||||
Assert.That (result, Is.GreaterThan (0), "MonoNativePlatform.TestInternalCounter()");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user