예제 #1
0
            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.");
            }
예제 #2
0
            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);
            }
예제 #3
0
            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.");
            }
예제 #4
0
            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>[]>();
            }