public static void AssertAllFeatures(BuildTargetGroup buildTargetGroup, FeatureInfoPredicate check) { Assert.IsTrue( CheckAllFeatures(buildTargetGroup, check), AssertFeaturesMessage(FeaturesToString(buildTargetGroup, (f) => !check(f)))); }
/// <summary> /// Check that only features in <paramref name="featureIds"/> for <paramref name="buildTargetGroup"/> pass the <paramref name="check"/>. /// </summary> /// <param name="buildTargetGroup">Build target group</param> /// <param name="featureIds">Features to check</param> /// <param name="check">Delegate used to check a FeatureInfo</param> /// <returns>True if the check passes, false if not</returns> public static bool CheckOnlyFeatures(BuildTargetGroup buildTargetGroup, string[] featureIds, FeatureInfoPredicate check) { return(GetFeatureInfos(buildTargetGroup).All(f => featureIds.Contains(f.Attribute.FeatureId) == check(f))); }
public static void AssertOnlyFeatures(BuildTargetGroup buildTargetGroup, string[] featureIds, FeatureInfoPredicate check) { Assert.IsTrue( CheckOnlyFeatures(buildTargetGroup, featureIds, check), AssertFeaturesMessage(FeaturesToString(buildTargetGroup, featureIds, (f) => !check(f)))); }
/// <summary> /// Checks if all features for the <paramref name="buildTargetGroup"/> pass the <paramref name="check"/>. /// </summary> /// <param name="buildTargetGroup">Build Target Group</param> /// <param name="check">Delegate used to check status</param> /// <returns>True if the check passes, false if not</returns> public static bool CheckAllFeatures(BuildTargetGroup buildTargetGroup, FeatureInfoPredicate check) { return(GetFeatureInfos(buildTargetGroup).All(f => check(f))); }
/// <summary> /// Builds a comma separated list of features identifier that pass the <paramref name="check"/> within <paramref name="buildTargetGroup"/> /// </summary> /// <param name="buildTargetGroup">Build Target Group</param> /// <param name="check">Delegate used to check status</param> /// <param name="exclude">Optional list of feature identifiers to exclude from the list</param> /// <returns>Comma separated list of features</returns> public static string FeaturesToString(BuildTargetGroup buildTargetGroup, FeatureInfoPredicate check, string[] exclude = null) { return(FeaturesToString(GetFeatureInfos(buildTargetGroup), check, exclude: exclude)); }
/// <summary> /// Builds a comma separated list of features from <paramref name="featureIds"/> in <paramref name="buildTargetGroup"/> that pass the <paramref name="check"/> /// </summary> /// <param name="buildTargetGroup">Build Target Group</param> /// <param name="featureIds">Feature ids to include</param> /// <param name="check">Delegate used to check status</param> /// <returns>Comma separated list of features</returns> public static string FeaturesToString(BuildTargetGroup buildTargetGroup, string[] featureIds, FeatureInfoPredicate check) { return(FeaturesToString(GetFeatureInfos(buildTargetGroup).Where(f => featureIds.Contains(f.Attribute.FeatureId)).ToArray(), check)); }
/// <summary> /// Builds a comma separated list of features that pass the <paramref name="check"/> within <paramref name="featureInfos"/> /// </summary> /// <param name="featureInfos">Feature infos</param> /// <param name="check">Delegate used to check status</param> /// <param name="exclude">Optional list of feature identifiers exclude</param> /// <returns>Comma separated list of features</returns> public static string FeaturesToString(FeatureHelpersInternal.FeatureInfo[] featureInfos, FeatureInfoPredicate check, string[] exclude = null) { return(string.Join(",", featureInfos .Where(f => (exclude == null || !exclude.Contains(f.Attribute.FeatureId)) && check(f)) .Select(f => f.Attribute.FeatureId))); }
public static void EnableFeatureInfos(BuildTargetGroup buildTargetGroup, bool enable, FeatureInfoPredicate predicate = null) { foreach (var featureInfo in GetFeatureInfos(buildTargetGroup)) { if (null == predicate || predicate(featureInfo)) { featureInfo.Feature.enabled = enable; } } }