public void ReduceValues_Should_ReduceToValue_When_PreserveCount(long preserve) { var settings = new HistorySettings(preserve); var values = GetValues(); var anomalies = GetAnomalies(); var count = values.Count; var reductionResult = settings.ReduceValues(values, anomalies, new DateTimeOffset(2018, 1, 2, 0, 0, 1, TimeSpan.Zero)); var expected = CompareUtilities.Min(count, CompareUtilities.Max(0, count - preserve + anomalies.Count)); reductionResult.Should().Be(expected); values.Count.Should().Be(count - (int)expected); anomalies.Count.Should().Be(0); }
public void ReduceValues_Should_ReduceToValue_When_PreserveTimeSpan(int preserve) { var settings = new HistorySettings(TimeSpan.FromSeconds(1)); var values = GetValues(); var anomalies = GetAnomalies(); var count = values.Count; var referenceDate = new DateTimeOffset(2018, 1, 5, 0, 0, 1, TimeSpan.Zero).AddDays(-preserve); var reductionResult = settings.ReduceValues(values, anomalies, referenceDate); var expected = CompareUtilities.Min(count, CompareUtilities.Max(0, (2 * (4 - preserve)) + anomalies.Count)); reductionResult.Should().Be(expected); values.Count.Should().Be(count - expected); anomalies.Count.Should().Be(0); }
public void Max_Should_ReturnHighestValue(int low, int high) { Assert.Equal(high, CompareUtilities.Max(low, high)); }