using System; using System.Collections.Generic; using System.Linq; namespace BoundaryLab.Domain; public sealed class Basket { private readonly int capacity; public Basket(int capacity) { if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity)); this.capacity = capacity; } public int Units { get; private set; } public bool TryAdd(int units) { if (units < 1 || units > capacity - Units) return false; Units += units; return true; } } public static class Shipping { public static bool NeedsFreight(Basket basket) => basket.Units >= 4; }