public void GetPropertyValue() { var propertyOrFieldReflection = new ClassToAnalyze(1, 1, 1).Reflection().GetPropertyOrField("PrivateProperty"); var value = propertyOrFieldReflection.GetValue <string>(); value.Should().Be("PrivateProperty"); }
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"); }