當前位置: 首頁>>代碼示例>>C#>>正文


C# GetShippingOptionRequest.GetDimensions方法代碼示例

本文整理匯總了C#中Nop.Services.Shipping.GetShippingOptionRequest.GetDimensions方法的典型用法代碼示例。如果您正苦於以下問題:C# GetShippingOptionRequest.GetDimensions方法的具體用法?C# GetShippingOptionRequest.GetDimensions怎麽用?C# GetShippingOptionRequest.GetDimensions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nop.Services.Shipping.GetShippingOptionRequest的用法示例。


在下文中一共展示了GetShippingOptionRequest.GetDimensions方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: can_calculate_with_multple_items_1

        public void can_calculate_with_multple_items_1()
        {
            var request = new GetShippingOptionRequest();
            request.Items.Add(new ShoppingCartItem()
                                  {
                                      Quantity = 3,
                                      ProductVariant = new ProductVariant()
                                                           {
                                                               Length = 2,
                                                               Width = 2,
                                                               Height = 2
                                                           }
                                  });
            request.Items.Add(new ShoppingCartItem()
                                  {
                                      Quantity = 1,
                                      ProductVariant = new ProductVariant()
                                                           {
                                                               Length = 3,
                                                               Width = 5,
                                                               Height = 2
                                                           }
                                  });

            decimal length, width, height = 0;
            request.GetDimensions(out width, out length, out height);
            Math.Round(length, 2).ShouldEqual(3.78);
            Math.Round(width, 2).ShouldEqual(5);    //preserve max width
            Math.Round(height, 2).ShouldEqual(3.78);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:30,代碼來源:CalculateDimensionsTests.cs

示例2: can_calculate_with_cubic_item_and_multiple_qty

        public void can_calculate_with_cubic_item_and_multiple_qty()
        {
            var request = new GetShippingOptionRequest();
            request.Items.Add(new ShoppingCartItem()
                                  {
                                      Quantity = 3,
                                      ProductVariant = new ProductVariant()
                                                           {
                                                               Length = 2,
                                                               Width = 2,
                                                               Height = 2
                                                           }
                                  });

            decimal length, width, height = 0;
            request.GetDimensions(out width, out length, out height);
            Math.Round(length, 2).ShouldEqual(2.88);
            Math.Round(width, 2).ShouldEqual(2.88);
            Math.Round(height, 2).ShouldEqual(2.88);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:20,代碼來源:CalculateDimensionsTests.cs

示例3: can_calculate_with_single_item_and_qty_1

        public void can_calculate_with_single_item_and_qty_1()
        {
            var request = new GetShippingOptionRequest();
            request.Items.Add(new ShoppingCartItem()
                                  {
                                      Quantity = 1,
                                      ProductVariant = new ProductVariant()
                                                           {
                                                               Length = 2,
                                                               Width = 2,
                                                               Height = 2
                                                           }
                                  });

            decimal length, width, height = 0;
            request.GetDimensions(out width, out length, out height);
            length.ShouldEqual(2);
            width.ShouldEqual(2);
            height.ShouldEqual(2);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:20,代碼來源:CalculateDimensionsTests.cs

示例4: can_calculate_with_multple_items_2

        public void can_calculate_with_multple_items_2()
        {
            //take 8 cubes of 1x1x1 which is "packed" as 2x2x2
            var request = new GetShippingOptionRequest();
            for (int i = 0; i < 8;i++)
                request.Items.Add(new ShoppingCartItem()
                {
                    Quantity = 1,
                    ProductVariant = new ProductVariant()
                    {
                        Length = 1,
                        Width = 1,
                        Height = 1
                    }
                });

            decimal length, width, height = 0;
            request.GetDimensions(out width, out length, out height);
            Math.Round(length, 2).ShouldEqual(2);
            Math.Round(width, 2).ShouldEqual(2);
            Math.Round(height, 2).ShouldEqual(2);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:22,代碼來源:CalculateDimensionsTests.cs

示例5: should_return_zero_with_all_zero_dimensions

        public void should_return_zero_with_all_zero_dimensions()
        {
            var request = new GetShippingOptionRequest();
            request.Items.Add(new ShoppingCartItem()
                                  {
                                      Quantity = 1,
                                      ProductVariant = new ProductVariant()
                                                           {
                                                               Length = 0,
                                                               Width = 0,
                                                               Height = 0
                                                           }
                                  });

            decimal length, width, height = 0;
            request.GetDimensions(out width, out length, out height);
            length.ShouldEqual(0);
            width.ShouldEqual(0);
            height.ShouldEqual(0);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:20,代碼來源:CalculateDimensionsTests.cs


注:本文中的Nop.Services.Shipping.GetShippingOptionRequest.GetDimensions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。