Table of Contents

Class PlatformHelper

Namespace
NUnit.Framework.Internal
Assembly
nunit.framework.dll

PlatformHelper class is used by the PlatformAttribute class to determine whether a platform is supported.

public class PlatformHelper
Inheritance
PlatformHelper
Inherited Members

Constructors

PlatformHelper()

Default constructor uses the operating system and common language runtime of the system.

public PlatformHelper()

PlatformHelper(OSPlatform, RuntimeFramework)

Contruct a PlatformHelper for a particular operating system and common language runtime. Used in testing.

public PlatformHelper(OSPlatform os, RuntimeFramework rt)

Parameters

os OSPlatform

OperatingSystem to be used

rt RuntimeFramework

RuntimeFramework to be used

Fields

OSPlatforms

Comma-delimited list of all supported OS platform constants

public const string OSPlatforms = "Win,Win32,Win32S,Win32NT,Win32Windows,WinCE,Win95,Win98,WinMe,NT3,NT4,NT5,NT6,Win2008Server,Win2008ServerR2,Win2012Server,Win2012ServerR2,Win2K,WinXP,Win2003Server,Vista,Win7,Windows7,Win8,Windows8,Win8.1,Windows8.1,Unix,Linux,Xbox,MacOSX"

Field Value

string

RuntimePlatforms

Comma-delimited list of all supported Runtime platform constants

public static readonly string RuntimePlatforms

Field Value

string

Properties

Reason

Return the last failure reason. Results are not defined if called before IsSupported( Attribute ) is called.

public string Reason { get; }

Property Value

string

Methods

IsPlatformSupported(PlatformAttribute)

Tests to determine if the current platform is supported based on a platform attribute.

public bool IsPlatformSupported(PlatformAttribute platformAttribute)

Parameters

platformAttribute PlatformAttribute

The attribute to examine

Returns

bool

IsPlatformSupported(string)

Test to determine if the a particular platform or comma- delimited set of platforms is in use.

public bool IsPlatformSupported(string platform)

Parameters

platform string

Name of the platform or comma-separated list of platform ids

Returns

bool

True if the platform is in use on the system

IsPlatformSupported(string[])

Test to determine if one of a collection of platforms is being used currently.

public bool IsPlatformSupported(string[] platforms)

Parameters

platforms string[]

Returns

bool