Clean up NETFX_CORE directive usage

This commit is contained in:
Pyit Phyo Aung
2016-10-11 14:14:13 +13:00
parent e74d6c5a4b
commit f50f276b76
121 changed files with 218 additions and 1441 deletions
+7 -26
View File
@@ -36,12 +36,7 @@ using System.Runtime.Serialization.Json;
#endif
using System.Text;
using System.Threading;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using TestMethod = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
using XAssert = Xunit.Assert;
@@ -63,7 +58,7 @@ namespace Newtonsoft.Json.Tests
{
public static IEnumerable<ConstructorInfo> GetConstructors(Type type)
{
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
return type.GetConstructors();
#else
return type.GetTypeInfo().DeclaredConstructors;
@@ -72,7 +67,7 @@ namespace Newtonsoft.Json.Tests
public static PropertyInfo GetProperty(Type type, string name)
{
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
return type.GetProperty(name);
#else
return type.GetTypeInfo().GetDeclaredProperty(name);
@@ -81,7 +76,7 @@ namespace Newtonsoft.Json.Tests
public static FieldInfo GetField(Type type, string name)
{
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
return type.GetField(name);
#else
return type.GetTypeInfo().GetDeclaredField(name);
@@ -90,7 +85,7 @@ namespace Newtonsoft.Json.Tests
public static MethodInfo GetMethod(Type type, string name)
{
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
return type.GetMethod(name);
#else
return type.GetTypeInfo().GetDeclaredMethod(name);
@@ -274,7 +269,7 @@ namespace Newtonsoft.Json.Tests
protected void TestSetup()
#endif
{
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
//CultureInfo turkey = CultureInfo.CreateSpecificCulture("tr");
//Thread.CurrentThread.CurrentCulture = turkey;
//Thread.CurrentThread.CurrentUICulture = turkey;
@@ -297,25 +292,11 @@ namespace Newtonsoft.Json.Tests
}
}
#if NETFX_CORE
public static class Console
{
public static void WriteLine(params object[] args)
{
}
}
#endif
public static class CustomAssert
{
public static void IsInstanceOfType(Type t, object instance)
{
#if NETFX_CORE
if (!instance.GetType().IsAssignableFrom(t))
throw new Exception("Not instance of type");
#else
Assert.IsInstanceOf(t, instance);
#endif
}
public static void Contains(IList collection, object value)
@@ -325,7 +306,7 @@ namespace Newtonsoft.Json.Tests
public static void Contains(IList collection, object value, string message)
{
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
Assert.Contains(value, collection, message);
#else
if (!collection.Cast<object>().Any(i => i.Equals(value)))