Add MacOsX and Xbox to platform attribute

This commit is contained in:
Charlie Poole 2012-10-08 16:12:43 -07:00
Родитель 6d852f0fba
Коммит 5c7cb5dedb
3 изменённых файлов: 48 добавлений и 0 удалений

Просмотреть файл

@ -21,7 +21,11 @@ namespace NUnit.Core
/// Comma-delimited list of all supported OS platform constants /// Comma-delimited list of all supported OS platform constants
/// </summary> /// </summary>
public static readonly string OSPlatforms = public static readonly string OSPlatforms =
#if CLR_2_0 || CLR_4_0
"Win,Win32,Win32S,Win32NT,Win32Windows,WinCE,Win95,Win98,WinMe,NT3,NT4,NT5,NT6,Win2K,WinXP,Win2003Server,Vista,Win2008Server,Win2008ServerR2,Win2012Server,Windows7,Windows8,Unix,Linux,Xbox,MacOSX";
#else
"Win,Win32,Win32S,Win32NT,Win32Windows,WinCE,Win95,Win98,WinMe,NT3,NT4,NT5,NT6,Win2K,WinXP,Win2003Server,Vista,Win2008Server,Win2008ServerR2,Win2012Server,Windows7,Windows8,Unix,Linux"; "Win,Win32,Win32S,Win32NT,Win32Windows,WinCE,Win95,Win98,WinMe,NT3,NT4,NT5,NT6,Win2K,WinXP,Win2003Server,Vista,Win2008Server,Win2008ServerR2,Win2012Server,Windows7,Windows8,Unix,Linux";
#endif
/// <summary> /// <summary>
/// Comma-delimited list of all supported Runtime platform constants /// Comma-delimited list of all supported Runtime platform constants
@ -198,6 +202,14 @@ namespace NUnit.Core
case "LINUX": case "LINUX":
isSupported = os.IsUnix; isSupported = os.IsUnix;
break; break;
#if (CLR_2_0 || CLR_4_0) && !NETCF
case "XBOX":
isSupported = os.IsXbox;
break;
case "MACOSX":
isSupported = os.IsMacOSX;
break;
#endif
default: default:
isSupported = IsRuntimeSupported(platformName); isSupported = IsRuntimeSupported(platformName);

Просмотреть файл

@ -206,6 +206,24 @@ namespace NUnit.Core
get { return (int)platform == 3; } // PlatformID.WinCE not defined in .NET 1.0 get { return (int)platform == 3; } // PlatformID.WinCE not defined in .NET 1.0
} }
#if (CLR_2_0 || CLR_4_0) && !NETCF
/// <summary>
/// Return true if the platform is Xbox
/// </summary>
public bool IsXbox
{
get { return platform == PlatformID.Xbox; }
}
/// <summary>
/// Return true if the platform is MacOSX
/// </summary>
public bool IsMacOSX
{
get { return platform == PlatformID.MacOSX; }
}
#endif
/// <summary> /// <summary>
/// Return true if the platform is Windows 95 /// Return true if the platform is Windows 95
/// </summary> /// </summary>

Просмотреть файл

@ -199,6 +199,24 @@ namespace NUnit.Core.Tests
"UNIX,Linux"); "UNIX,Linux");
} }
#if (CLR_2_0 || CLR_4_0) && !NETCF
[Test]
public void DetectXbox()
{
CheckOSPlatforms(
new OSPlatform(PlatformID.Xbox, new Version(0, 0)),
"Xbox");
}
[Test]
public void DetectMacOSX()
{
CheckOSPlatforms(
new OSPlatform(PlatformID.MacOSX, new Version(0, 0)),
"MacOSX");
}
#endif
[Test] [Test]
public void DetectNet10() public void DetectNet10()
{ {