C# tests: a default ImmutableArray in a contract list is refused
This commit is contained in:
parent
293cddb80e
commit
e27e6170ac
1 changed files with 5 additions and 0 deletions
|
|
@ -106,6 +106,11 @@ public sealed class ReadOnlyListTests
|
|||
args[index] = null;
|
||||
var list = Assert.Throws<ThingDomainException>(() => 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<ThingDomainException>(() => door.Call(args), $"{door.Name}: default array")!;
|
||||
Assert.That(uninitialised.Bound, Is.EqualTo("present"), door.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue