NUnit.Framework.Internal.RuntimeFramework.Supports C# (CSharp) Method

Supports() public method

Returns true if the current framework matches the one supplied as an argument. Two frameworks match if their runtime types are the same or either one is RuntimeType.Any and all specified version components are equal. Negative (i.e. unspecified) version components are ignored.
public Supports ( RuntimeFramework target ) : bool
target RuntimeFramework The RuntimeFramework to be matched.
return bool
        public bool Supports(RuntimeFramework target)
        {
            if (Runtime != RuntimeType.Any
                && target.Runtime != RuntimeType.Any
                && Runtime != target.Runtime)
                return false;

            if (AllowAnyVersion || target.AllowAnyVersion)
                return true;

            if (!VersionsMatch(ClrVersion, target.ClrVersion))
                return false;

            return FrameworkVersion.Major >= target.FrameworkVersion.Major && FrameworkVersion.Minor >= target.FrameworkVersion.Minor;
        }

Usage Example

Example #1
0
        private bool IsRuntimeSupported(RuntimeType runtime, string versionSpecification)
        {
            Version version = versionSpecification == null
                ? RuntimeFramework.DefaultVersion
                : new Version(versionSpecification);

            RuntimeFramework target = new RuntimeFramework(runtime, version);

            return(_rt.Supports(target));
        }
All Usage Examples Of NUnit.Framework.Internal.RuntimeFramework::Supports