Exemplo n.º 1
0
        public void Test_Negative_Number_Itme_Result_Is_ArgumentException_With_FluentAssertion()
        {
            //arrange
            var target = new GenericAggragate <Order>();

            target.Entities      = ProduceOrders();
            target.NumIntoAGroup = -1;
            //act
            Action act = () => target.DoAggregate(x => x.Revenue);

            //assert
            act.ShouldThrow <ArgumentException>();
        }
Exemplo n.º 2
0
        public void Test_Not_Exist_ColumnName_Result_Is_ArgumentException_With_FluentAssertion()
        {
            //未完.不知道要如何模擬不存在的欄位
            //arrange
            var target = new GenericAggragate <Order>();

            target.Entities      = ProduceOrders();
            target.NumIntoAGroup = 4;
            List <int> result = new List <int> {
                50, 66, 60
            };
            //act
            Action act = () => target.DoAggregate(x => x.Cost);

            //assert
            act.ShouldThrow <ArgumentException>();
        }
Exemplo n.º 3
0
        public void Test_Zero_Itme_Result_Is_Zero()
        {
            //arrange
            var target = new GenericAggragate <Order>();

            target.Entities      = ProduceOrders();
            target.NumIntoAGroup = 0;
            List <int> result = new List <int> {
                0
            };

            //act
            target.DoAggregate(x => x.Cost);
            List <int> actual = target.SumResults;

            //assert
            CollectionAssert.AreEqual(result, actual);
        }
Exemplo n.º 4
0
        public void Test_11_Goods_4_Revenue_Itmes_Into_One_Group_Each_Group_SUM_Is_50_66_60()
        {
            //arrange
            var target = new GenericAggragate <Order>();

            target.Entities      = ProduceOrders();
            target.NumIntoAGroup = 4;
            List <int> result = new List <int> {
                50, 66, 60
            };

            //act
            target.DoAggregate(x => x.Revenue);
            List <int> actual = target.SumResults;

            //assert
            CollectionAssert.AreEqual(result, actual);
        }
Exemplo n.º 5
0
        public void Test_11_Goods_3_Cost_Itmes_Into_One_Group_Each_Group_SUM_Is_6_15_24_21()
        {
            //arrange
            var target = new GenericAggragate <Order>();

            target.Entities      = ProduceOrders();
            target.NumIntoAGroup = 3;
            List <int> result = new List <int> {
                6, 15, 24, 21
            };

            //act
            target.DoAggregate(x => x.Cost);
            List <int> actual = target.SumResults;

            //assert
            CollectionAssert.AreEqual(result, actual);
        }