本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}