Implemented ShippingCostCalculatorBase.cs
This commit is contained in:
parent
ed9908d011
commit
d2424e2c67
1 changed files with 11 additions and 2 deletions
|
|
@ -20,7 +20,16 @@ public abstract class ShippingCostCalculatorBase(ICountryDistanceProvider countr
|
||||||
/// <returns>Sum of the longest and shortest side</returns>
|
/// <returns>Sum of the longest and shortest side</returns>
|
||||||
protected static int SumOfLongestAndShortestSides(IMeasuredBox box)
|
protected static int SumOfLongestAndShortestSides(IMeasuredBox box)
|
||||||
{
|
{
|
||||||
// TODO
|
int[] sides = [box.Width, box.Height, box.Depth];
|
||||||
return -1;
|
for (int i = 0; i < sides.Length; i++)
|
||||||
|
{
|
||||||
|
if (sides[i] <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Array.Sort(sides);
|
||||||
|
return sides[0] + sides[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue