public static void FrameworkID_Name_Formats_Correctly() { FrameworkID id = FrameworkID.NetCore | FrameworkID.NetNative; string formatted = id.Name(); Assert.True(formatted.Contains("NetCore") && formatted.Contains("NetNative"), String.Format("FrameworkID.Name should have contained NetCore and NetNative, but actual was \"{0}\"", formatted)); }
// Extension method that returns 'true' if the given FrameworkID // includes the FrameworkID on which this code is currently executing. public static bool MatchesCurrent(this FrameworkID frameworkID) { return((Current & frameworkID) != 0); }
// Extension method for FrameworkID to provide name. // "G" formatting will expand to enum's name or collection if multiple. public static string Name(this FrameworkID frameworkID) { return(frameworkID.ToString("G")); }
/// <summary> /// Creates the attribute stating that a decorated metadata framework targets a framework <paramref name="targetFramework"/> and that the name (displayed in GUI) of this framework is <paramref name="frameworkName"/> /// </summary> /// <param name="targetFramework">The ID of the target framework</param> /// <param name="frameworkName">Specifies the name of the target framework (typically used in conjunction with FrameworkID.Custom)</param> public TargetFrameworkAttribute(FrameworkID targetFramework, string frameworkName = null) { TargetFrameworkID = targetFramework; FrameworkName = frameworkName; }