Refuse a list Add that creates nothing

CreateElement returned null without a notice when the element type itself
had no parameterless constructor, and the Studio added that null. The
notice now follows the result: nothing made is refused, except the null
a Nullable<T> slot legitimately holds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-14 14:31:45 +02:00
commit 04c7c6bcd8
2 changed files with 12 additions and 4 deletions

View file

@ -81,6 +81,10 @@ namespace GameCult.Caching.Tests
Assert.That(model.CreateElement(typeof(InspectPicky), typeof(InspectNeedsArgs), out var refused), Is.Null);
Assert.That(refused, Does.Contain("parameterless"));
Assert.That(model.CreateElement(typeof(InspectNeedsArgs), typeof(InspectNeedsArgs), out var bare), Is.Null);
Assert.That(bare, Does.Contain("parameterless"), "a plain element type that cannot be made says so; nothing is added");
Assert.That(model.CreateElement(typeof(int?), typeof(int?), out var nullable), Is.Null);
Assert.That(nullable, Is.Null, "null is a Nullable<T> element, not a failure");
}
[Test]