From d2424e2c672efc73b7474b78373c43d54e7be724 Mon Sep 17 00:00:00 2001 From: MarcUs7i <96580944+MarcUs7i@users.noreply.github.com> Date: Fri, 9 May 2025 10:33:29 +0200 Subject: [PATCH] Implemented ShippingCostCalculatorBase.cs --- .../Implementations/ShippingCostCalculatorBase.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ShippingCosts/Implementations/ShippingCostCalculatorBase.cs b/ShippingCosts/Implementations/ShippingCostCalculatorBase.cs index 3017e99..8cc2b3e 100644 --- a/ShippingCosts/Implementations/ShippingCostCalculatorBase.cs +++ b/ShippingCosts/Implementations/ShippingCostCalculatorBase.cs @@ -20,7 +20,16 @@ public abstract class ShippingCostCalculatorBase(ICountryDistanceProvider countr /// Sum of the longest and shortest side protected static int SumOfLongestAndShortestSides(IMeasuredBox box) { - // TODO - return -1; + int[] sides = [box.Width, box.Height, box.Depth]; + for (int i = 0; i < sides.Length; i++) + { + if (sides[i] <= 0) + { + return 0; + } + } + + Array.Sort(sides); + return sides[0] + sides[2]; } }