コード例 #1
0
        public void Order_ItemsPrice_IsCorrect_WithUnExpectedParameters()
        {
            // arrange
            OperationNormalPrices operationNoormalPrices = new OperationNormalPrices();
            Order order = new Order(operationNoormalPrices);
            Items items = new Items();

            items.Add(new Item()
            {
                Name = "西瓜", Price = 0.0
            });

            // act
            order.Items = items;

            // assert
            Assert.Null(order.Items);
        }
コード例 #2
0
        public void Order_ItemsCountAfterFilter_WithExpectedParameters()
        {
            // arrange
            int expected = 4;
            OperationNormalPrices operationNormalPrices = new OperationNormalPrices();
            Order order = new Order(operationNormalPrices);
            Items items = new Items();

            order.Items = items;

            // act
            int countAfterFilter = -1;

            order.FilteredItemsCountEvents += (obj) => { countAfterFilter = obj; };
            var result = order.GetPrices();

            // assert
            Assert.True(countAfterFilter == expected);
        }
コード例 #3
0
        public void Order_MergeOrders_ThrowException()
        {
            // arrange
            MergeOrders <Order>   merge = new MergeOrders <Order>();
            OperationNormalPrices operationNoormalPrices = new OperationNormalPrices();
            VipOrder order1 = new VipOrder(operationNoormalPrices)
            {
            };
            VipOrder order2 = new VipOrder(operationNoormalPrices)
            {
            };

            // act

            IMergeOrderList <VipOrder> result  = merge.MergeNormal(order1, order2);
            IMergeOrderList <VipOrder> result2 = merge.MergeNormal <VipOrder>(order1, order2);

            // assert
            Assert.True(result.GetType().Name == typeof(MergeOrderList <VipOrder>).Name);
        }
コード例 #4
0
        public void Order_GetPrices_WithExpectedParameters()
        {
            // arrange
            double expectedTotalPrice = 10935.99;
            OperationNormalPrices operationNormalPrices = new OperationNormalPrices();
            Order order = new Order(operationNormalPrices);
            Items items = new Items();

            items.Add(new Item()
            {
                Code = "Normal_003", Name = "西瓜", Price = 39.99
            });
            order.Items = items;

            // act
            order.FilteredItemsCountEvents += (obj) => { };
            var result = order.GetPrices();

            // assert
            Assert.True(result == expectedTotalPrice);
        }