public void Aggregate(string?source, string target, DateTime time, StatusAuditReport?additionalReport) { StatusAuditReport report = additionalReport ?? new StatusAuditReport(time, TimeSpan.Zero, null, StatusAuditAlert.None); if (CommonAlert != report.Alert) { throw new InvalidOperationException("Only results with the same alert can be aggregated!"); } if (Target != RenderTarget(target)) { throw new InvalidOperationException("Only results with the same target can be aggregated!"); } RatingSum += report.Alert?.Rating ?? StatusRating.Okay; Sources.Add(RenderSource(source)); TimeRange.AddSample(time); AuditStartRange.AddSample(report.AuditStartTime); AuditDurationRange.AddSample(report.AuditDuration); NextAuditTime = (NextAuditTime == null) ? report.NextAuditTime : new DateTime(Math.Min(NextAuditTime.Value.Ticks, (report.NextAuditTime ?? DateTime.MaxValue).Ticks)); PropertyRanges = new List <StatusPropertyRange>(); }