public static IStreamable <PartitionKey <int>, double> GroupAggregateAverageTestRecord( this IStreamable <PartitionKey <int>, LaggingPartitionCleanupTests.TestRecord> source) { return(source.GroupAggregate( testRecord => testRecord.Key, w => w.Average(testRecord => testRecord.Payload), (key, testRecord) => testRecord)); }