Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static implicit operator AggregationDictionary(Aggregation aggregator)
if (b.Name.IsNullOrEmpty())
throw new ArgumentException($"{aggregator.GetType().Name}.Name is not set!");

dict.Add(b.Name, agg);
dict.Add(agg);
}
return dict;
}
Expand All @@ -46,8 +46,16 @@ public static implicit operator AggregationDictionary(Aggregation aggregator)
if (b.Name.IsNullOrEmpty())
throw new ArgumentException($"{aggregator.GetType().Name}.Name is not set!");

return new AggregationDictionary { { b.Name, aggregator } };
return new AggregationDictionary { { aggregator } };
}

public void Add(string key, AggregationContainer value) => BackingDictionary.Add(ValidateKey(key), value);

public void Add(AggregationContainer value)
{
if (value.Variant.Name.IsNullOrEmpty())
throw new ArgumentException($"{value.GetType().Name}.Name is not set!");

BackingDictionary.Add(ValidateKey(value.Variant.Name), value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public async Task CanSerializeAggregationsWrittenInVariousWays_WhichIncludeMulti
var aggs = new AggregationDictionary
{
{
"name_of_child_agg", new ChildrenAggregation("name_of_child_agg")
new ChildrenAggregation("name_of_child_agg")
{
Type = "commits",
Aggregations = new AggregationDictionary
{
{"average_per_child", new AverageAggregation("average_per_child", "confidenceFactor")},
{"max_per_child", new MaxAggregation("max_per_child", "confidenceFactor")},
{"min_per_child", new MinAggregation("min_per_child", "confidenceFactor")},
{new AverageAggregation("average_per_child", "confidenceFactor")},
{new MaxAggregation("max_per_child", "confidenceFactor")},
{new MinAggregation("min_per_child", "confidenceFactor")},
}
}
}
Expand Down