public void SetterOnly () { // that ensure the setter is not linked away, NotPreserved np = new NotPreserved (); np.One = 1; PropertyInfo pi = typeof (NotPreserved).GetProperty ("One"); // check the *unused* setter absence from the application Assert.Null (pi.GetGetMethod (), "getter"); Assert.NotNull (pi.GetSetMethod (), "setter"); }
public void GetterOnly () { // that ensure the getter is not linked away, // which means the property will be available for MEF_3862 NotPreserved np = new NotPreserved (); Assert.That (np.Two, Is.EqualTo (0), "Two==0"); PropertyInfo pi = typeof (NotPreserved).GetProperty ("Two"); // check the *unused* setter absence from the application Assert.NotNull (pi.GetGetMethod (), "getter"); Assert.Null (pi.GetSetMethod (), "setter"); }