Example #1
0
        public void SplitEvery4RowsAndGetSumFromRevenueCellTest()
        {
            // arrange
            TableSplitter ts = new TableSplitter();

            // act
            ICollection actual   = ts.SplitAndGetSum <Order>(this._orders, 4, this.GetRevenueCell) as ICollection;
            ICollection expected = new List <int> {
                50, 66, 60
            };

            // act & assert
            CollectionAssert.AreEqual(expected, actual);
        }
Example #2
0
        public void SplitRowsByZeroAndTriggerArgumentExceptionTest()
        {
            // arrange
            TableSplitter ts = new TableSplitter();

            // act
            Action expected = () =>
            {
                ICollection actual = ts.SplitAndGetSum <Order>(this._orders, 0, (Order order) => 0) as ICollection;
            };

            // act & assert
            expected.ShouldThrow <ArgumentException>();
        }
Example #3
0
        public void SplitEvery3RowsAndGetSumFromCostCellTest()
        {
            // arrange
            TableSplitter ts = new TableSplitter();

            // act
            ICollection actual   = ts.SplitAndGetSum <Order>(this._orders, 3, this.GetCostCell) as ICollection;
            ICollection expected = new List <int> {
                6, 15, 24, 21
            };

            // act & assert
            CollectionAssert.AreEqual(expected, actual);
        }