diff --git a/tests/GameCult.Thing.Contract.Tests/ReadOnlyListTests.cs b/tests/GameCult.Thing.Contract.Tests/ReadOnlyListTests.cs index 5345c60..cd79648 100644 --- a/tests/GameCult.Thing.Contract.Tests/ReadOnlyListTests.cs +++ b/tests/GameCult.Thing.Contract.Tests/ReadOnlyListTests.cs @@ -106,6 +106,11 @@ public sealed class ReadOnlyListTests args[index] = null; var list = Assert.Throws(() => door.Call(args), $"{door.Name}: nil list")!; Assert.That(list.Bound, Is.EqualTo("present"), door.Name); + + // What a nil list decodes to: a default (uninitialised) ImmutableArray, which throws on first use. + args[index] = Activator.CreateInstance(typeof(System.Collections.Immutable.ImmutableArray<>).MakeGenericType(element)); + var uninitialised = Assert.Throws(() => door.Call(args), $"{door.Name}: default array")!; + Assert.That(uninitialised.Bound, Is.EqualTo("present"), door.Name); } }