public void ShouldThrowException_WhenPropertyDoesNotExist() { // Arrange var value = new ComplexTestClass(); var immutable = new Immutable <ComplexTestClass>(value); // Act Action result = () => immutable.Array <SimpleTestClass>("Thing"); // Assert result.Should().Throw <ArgumentException>().WithMessage("Property 'Thing' does not exist on this object."); }
public void ShouldReturnArrayOfSameSize_WhenPropertyIsAnArray() { // Arrange var value = new ComplexTestClass(); var immutable = new Immutable <ComplexTestClass>(value); // Act var result = immutable.Array <SimpleTestClass>("SomeThings"); // Assert result.Length.Should().Be(value.SomeThings.Length); }
public void ShouldThrowException_WhenPropertyIsNotAnArray() { // Arrange var value = new ComplexTestClass(); var immutable = new Immutable <ComplexTestClass>(value); // Act Action result = () => immutable.Array <SimpleTestClass>("Things"); // Assert result.Should().Throw <ArgumentException>().WithMessage("Property 'Things' is not an Array type."); }
public void ShouldReturnArrayOfImmutables_WhenPropertyIsAnArray() { // Arrange var value = new ComplexTestClass(); var immutable = new Immutable <ComplexTestClass>(value); // Act var result = immutable.Array <SimpleTestClass>("SomeThings"); // Assert result.Should().BeOfType <IImmutable <SimpleTestClass>[]>(); }