当前位置: 首页>>代码示例>>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;未经允许,请勿转载。