예제 #1
0
            public void Ctor_value_in_attribute_returns_copy_with_attribute(string propertyName, string ctorValue)
            {
                var expected = new SimpleAttribute(ctorValue);

                var sut = new Mirror(new SimpleType()).AddAttribute<SimpleAttribute>(
                    propertyName,
                    new AttributeConfiguration().CtorValue(ctorValue));

                sut.Object.GetType().SingleAttribute<SimpleAttribute>(propertyName).ShouldBeEquivalentTo(expected);
            }
예제 #2
0
            public void Ctor_and_property_set_value_in_attribute_returns_copy_with_attribute(
                string propertyName,
                string ctorValue,
                int memberData)
            {
                var expected = new SimpleAttribute(ctorValue) { IntValue = memberData };

                var sut = new Mirror(new SimpleType()).AddAttribute<SimpleAttribute>(
                    propertyName,
                    new AttributeConfiguration().CtorValue(ctorValue).Property("IntValue", memberData));

                sut.Object.GetType().SingleAttribute<SimpleAttribute>(propertyName).ShouldBeEquivalentTo(expected);
            }
예제 #3
0
            public void Ctor_and_property_set_value_in_attribute_returns_copy_with_attribute_with_Anonymous_type(
                string propertyName,
                string ctorValue,
                int memberData)
            {
                var expected = new SimpleAttribute(ctorValue) { IntValue = memberData };
                var anonymous = new { StringProperty = default(string), IntProperty = default(int), BooleanProperty = default(bool) };

                var sut = new Mirror(anonymous).AddAttribute<SimpleAttribute>(
                    propertyName,
                    new AttributeConfiguration().CtorValue(ctorValue).Property("IntValue", memberData));

                sut.Object.GetType().SingleAttribute<SimpleAttribute>(propertyName).ShouldBeEquivalentTo(expected);
            }