Skip to content

IsEquivalent on default ImmutableArray throws exception. #3772

@manfred-brands

Description

@manfred-brands

NUnit version 3.13.0

An ImmutableArray is a structure, but can contained a null array.
The following test fails with an InvalidOperationException: This operation cannot be performed on a default instance of ImmutableArray

ImmutableArray<string> expected = ImmutableArray.Create("Test");
ImmutableArray<string> actual = default(ImmutableArray<string>);

Assert.That(actual, Is.EquivalentTo(expected));

Same for Assert.That(actual, Is.Not.Empty);

It is a pity that Microsoft doesn't treat this the same as ImmutableArray<string>.Empty.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions