public void ObjectGetterTest() { MyPointConstructor pt = new MyPointConstructor(3, 2); PropertyInfo property = pt.GetType().GetProperty("X"); DynamicMethodUtil.GenericGetter getter = DynamicMethodUtil.CreatePropertyGetter(property); Assert.AreEqual(pt.X, getter(pt), "Struct getter incorrect"); }
public void SimpleConstructorNoInitTest() { MyPointConstructor pt = new MyPointConstructor(3, 9); Serializer s = new Serializer(pt.GetType()); string result = s.Serialize(pt); MyPointConstructor actual = (MyPointConstructor)s.Deserialize(result); Assert.AreEqual(pt, actual, "Simple Constructor with no initializer failed"); }
public override bool Equals(object obj) { if (base.Equals(obj)) { return(true); } else { if (obj != null && obj is MyPointConstructor) { MyPointConstructor otherPt = (MyPointConstructor)obj; return(otherPt.X == this.X && otherPt.Y == this.Y); } } return(false); }