public void ColumnApplyShouldOperateByColumns() { var spreadsheet = new Spreadsheet( new[] { new[] { "1", "2" }, new[] { "1", "3" }, new[] { "1", "4" }, }); spreadsheet.ColumnApply(x => x.All(y => y == "1"), 0).Should().BeTrue(); spreadsheet.ColumnApply(x => x.Select(int.Parse).Sum(), 1).Should().Be(9); }
public void ColumnApplyShouldSkipRows() { var spreadsheet = new Spreadsheet( new[] { new[] { "1", "2" }, new[] { "1", "3" }, new[] { "1", "4" }, }); spreadsheet.ColumnApply(x => x.Select(int.Parse).Sum(), 1, 0).Should().Be(9); spreadsheet.ColumnApply(x => x.Select(int.Parse).Sum(), 1, 1).Should().Be(7); spreadsheet.ColumnApply(x => x.Select(int.Parse).Sum(), 1, 2).Should().Be(4); }