public void Initialization_Property_ValueAssignable()
        {
            var propertyInfo = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(ValueType));
            int value        = 7;

            new NamedArgumentDeclaration(propertyInfo, value);
        }
        public void Initialization_Property_WithNullArgument()
        {
            var nullableMember2 = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(object));
            var nullableMember1 = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(int?));

            new NamedArgumentDeclaration(nullableMember1, null);
            new NamedArgumentDeclaration(nullableMember2, null);
        }
        public void Initialization_Property_WithInvalidNullArgument()
        {
            var nonNullMember = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(int));

            Assert.That(
                () => new NamedArgumentDeclaration(nonNullMember, null),
                Throws.ArgumentException
                .With.ArgumentExceptionMessageEqualTo("Parameter 'value' has type '<null>' when type 'System.Int32' was expected.", "value"));
        }
        public void Initialization_Property_ValueNotAssignable()
        {
            var    propertyInfo = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(ValueType));
            string value        = "not assignable";

            Assert.That(
                () => new NamedArgumentDeclaration(propertyInfo, value),
                Throws.ArgumentException
                .With.ArgumentExceptionMessageEqualTo("Parameter 'value' has type 'System.String' when type 'System.ValueType' was expected.", "value"));
        }
        public void Initialization_Property()
        {
            var propertyInfo = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(ValueType));
            int value        = 7;

            var declaration = new NamedArgumentDeclaration(propertyInfo, value);

            Assert.That(declaration.MemberInfo, Is.SameAs(propertyInfo));
            Assert.That(declaration.MemberType, Is.SameAs(typeof(ValueType)));
            Assert.That(declaration.Value, Is.EqualTo(value));
        }
        public void Initialization_Property_WithInvalidNullArgument()
        {
            var nonNullMember = CustomAttributeReflectionObjectMother.GetPropertyWithType(typeof(int));

            new NamedArgumentDeclaration(nonNullMember, null);
        }