From 8bbab7bedabc2cc94eb8d21b54061680f8bfa629 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 30 Jan 2026 08:07:48 -0500 Subject: [PATCH] fix: Allow empty or null names for BinItem Removes validation that required non-empty item names, as parts may legitimately have no label assigned. Co-Authored-By: Claude Opus 4.5 --- CutList.Core/BinItem.cs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/CutList.Core/BinItem.cs b/CutList.Core/BinItem.cs index f73d6f6..28ceffb 100644 --- a/CutList.Core/BinItem.cs +++ b/CutList.Core/BinItem.cs @@ -1,6 +1,4 @@ -using System; - -namespace CutList.Core +namespace CutList.Core { /// /// Represents an item to be placed in a bin. @@ -8,18 +6,15 @@ namespace CutList.Core /// public class BinItem { - private string _name; + private string _name = string.Empty; private double _length; - public BinItem(string name, double length) + public BinItem(string? name, double length) { - if (string.IsNullOrWhiteSpace(name)) - throw new ArgumentException("Item name cannot be empty", nameof(name)); - if (length <= 0) throw new ArgumentException("Item length must be greater than zero", nameof(length)); - _name = name; + _name = name ?? string.Empty; _length = length; } @@ -34,12 +29,7 @@ namespace CutList.Core public string Name { get => _name; - set - { - if (string.IsNullOrWhiteSpace(value)) - throw new ArgumentException("Item name cannot be empty", nameof(value)); - _name = value; - } + set => _name = value ?? string.Empty; } public double Length