public void MemberValueTest() { MV mv = new MV(10, 20); // Superfluous, but still. Assert.AreEqual(10, mv.Field()); Assert.AreEqual(20, mv.Property); // Get all members of MV (fields + properties) IList <IMemberValue> members = typeof(MV).GetTypeInfo().GetMembers(); // alter _field IMemberValue fieldMember = members.Single(m => m.Info.Name == "_field"); fieldMember.SetValue(mv, 100); Assert.AreEqual(100, (int)fieldMember.GetValue(mv)); Assert.AreEqual(100, mv.Field()); // alter Property IMemberValue propertyMember = members.Single(m => m.Info.Name == "Property"); propertyMember.SetValue(mv, 200); Assert.AreEqual(200, (int)propertyMember.GetValue(mv)); Assert.AreEqual(200, mv.Property); }