示例#1
0
        public void GetPropertyValue()
        {
            var propertyOrFieldReflection = new ClassToAnalyze(1, 1, 1).Reflection().GetPropertyOrField("PrivateProperty");
            var value = propertyOrFieldReflection.GetValue <string>();

            value.Should().Be("PrivateProperty");
        }
示例#2
0
        public void SetFieldValue()
        {
            var propertyOrFieldReflection = new ClassToAnalyze(1, 1, 1).Reflection().GetPropertyOrField("_privateField");

            propertyOrFieldReflection.SetValue("test");
            var value = propertyOrFieldReflection.GetValue <string>();

            value.Should().Be("test");
        }