private void AddFactorProperties(SetChannelPropertyParameters outerParameters, SetChannelPropertyParameters innerParameters, IGrouping <double?, Channel> factor) { if (factor.Key == null) { return; } //For each ChannelProperty that has a factor foreach (var obj in outerParameters.FactorParameters) { var prop = obj.Item2.Property; //Get the factor property that also needs to be included (e.g. UpperErrorLimitFactor) var cache = outerParameters.GetPropertyCache(prop); Debug.Assert(factor.All(g => (double?)cache.Property.GetValue(g) == factor.Key), "Generic and specific Factor were not equal for at least one channel"); //Generate the factor's property name var name = outerParameters.GetFactorParameterName(prop, cache); //And add it innerParameters.CustomParameters.Add(new CustomParameter(name, factor.Key)); } }
/// <summary> /// Validates a group of operations with the same context Uri. /// </summary> /// <param name="operations">Operations to validate.</param> private void ValidateOperationMetadataGroup(IGrouping<string, ODataOperation> operations) { Debug.Assert(operations != null, "operations must not be null."); Debug.Assert(operations.Any(), "operations.Any()"); Debug.Assert(operations.All(o => this.GetOperationMetadataString(o) == operations.Key), "The operations should be grouped by their metadata."); if (operations.Count() > 1 && operations.Any(o => o.Target == null)) { throw new ODataException(OData.Core.Strings.ODataJsonLightEntryAndFeedSerializer_ActionsAndFunctionsGroupMustSpecifyTarget(operations.Key)); } foreach (IGrouping<string, ODataOperation> operationsByTarget in operations.GroupBy(this.GetOperationTargetUriString)) { if (operationsByTarget.Count() > 1) { throw new ODataException(OData.Core.Strings.ODataJsonLightEntryAndFeedSerializer_ActionsAndFunctionsGroupMustNotHaveDuplicateTarget(operations.Key, operationsByTarget.Key)); } } }
private static bool MultipleAlbumsWithSameNameExist(IGrouping <string, Track> albumGroup) { return(albumGroup.Select(t => t.Artist).Distinct().Count() > 1 && (albumGroup.Select(t => t.AlbumArtist).Distinct().Count() > 1 || albumGroup.All(t => string.IsNullOrWhiteSpace(t.AlbumArtist)))); }
private IEnumerable<string> GetCss(IGrouping<int, ShoppingListItemModel> lookup) { if (lookup.All(x => x.Css.Length > 0)) yield return "nothing-needed"; if (lookup.All(x => x.Css == "zero")) yield return "zero"; if (lookup.All(x => x.Css == "picked")) yield return "picked"; }