public void ShouldThrowException_WhenObjectIsNotAnArray() { // Arrange var value = new SimpleTestClass(); var immutable = new Immutable <SimpleTestClass>(value); // Act Action result = () => immutable.ArrayLength(); // Assert result.Should().Throw <InvalidOperationException>().WithMessage("Immutable of type 'SimpleTestClass' is not an array."); }
public void ShouldReturnArrayLength_WhenObjectIsAnArray() { // Arrange var value = new SimpleTestClass[3] { new SimpleTestClass { Prop1 = 1 }, new SimpleTestClass { Prop1 = 2 }, new SimpleTestClass { Prop1 = 3 } }; var immutable = new Immutable <SimpleTestClass[]>(value); // Act var result = immutable.ArrayLength(); // Assert result.Should().Be(3); }