Closed
Description
Similar to #6659, but for Max(), Min() and Sum().
New Unit tests for Max and Min:
[Fact]
public void TestDateTimeComputations_MaxMin_WithNulls()
{
var dateTimeColumn = new DateTimeDataFrameColumn("DateTime", new DateTime?[]
{
null,
new DateTime(2022, 1, 1),
new DateTime(2020, 1, 1),
new DateTime(2023, 1, 1),
new DateTime(2021, 1, 1),
null
});
Assert.Equal(new DateTime(2020, 1, 1), dateTimeColumn.Min());
Assert.Equal(new DateTime(2023, 1, 1), dateTimeColumn.Max());
}
[Fact]
public void TestIntComputations_MaxMin_WithNulls()
{
var column = new Int32DataFrameColumn("Int", new int?[]
{
null,
2,
1,
4,
3,
null
});
Assert.Equal(1, column.Min());
Assert.Equal(4, column.Max());
}
fail with Messages:
Assert.Equal() Failure
Expected: 1
Actual: 0
and
Assert.Equal() Failure
Expected: 2020-01-01T00:00:00.0000000
Actual: 0001-01-01T00:00:00.0000000
Unit Test:
[Fact]
public void TestComputations_MaxMin_OnEmptyColumn()
{
var column = new Int32DataFrameColumn("Int");
Assert.Null(column.Min());
Assert.Null(column.Max());
}
crashes with
System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
New Unit tests for Sum:
[Fact]
public void TestIntSum_OnColumnWithNullsOnly()
{
var column = new Int32DataFrameColumn("Int", new int?[] { null, null });
Assert.Null(column.Sum());
}
[Fact]
public void TestIntSum_OnEmptyColumn()
{
var column = new Int32DataFrameColumn("Int");
Assert.Null(column.Sum());
}
crashes with
_System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Metadata
Metadata
Assignees
Labels
No labels