The team noticed that the method for preparing the warehouse restocking plan sometimes returns different results for the same call. The problem appears when reading the result repeatedly and when calculating the final statistics for the input items.
BuildPlan method accepts an IEnumerable<string> with product codes.Trim() should be included in the plan.RestockItem object with a Sku field containing the trimmed value.Planned field in the result must reflect the number of all valid input items after normalization, including duplicates.Skipped field must reflect the number of input items that were not included in the plan because they were empty or whitespace-only.var source = new List<string> { " A-10 ", "", "B-20" };
var result = planner.BuildPlan(source);
source.Add("C-30");
result.Items twice, and also check Planned and Skipped.result.Items must be stable when enumerated repeatedly.BuildPlan must not change the already built result." A-10 ", "", "B-20", the result must be:
Planned = 2Skipped = 1A-10, B-20.NET 8C# 12reviewBuildPlan is called in memory, without I/O and without multithreadingUse line comments to explain the problem, its impact, the fix and how to test it.