public void ConvenienceConstructorShouldHaveSameEffectAsLocationConstructor() { Vector location = new Vector(3,7); int size = 42; Square square1 = new Square(location, size); Square square2 = new Square(location.X, location.Y, size); Assert.AreEqual(square1.ToString(), square2.ToString()); }
public void ConvenienceConstructorsShouldHaveSameEffectAsLocationConstructor() { Vector location = new Vector(3, 7); Vector size = new Vector(42, 77); Rectangle standardConstructed = new Rectangle(location, size); Rectangle convenienceConstructed1 = new Rectangle(location, size.X, size.Y); Rectangle convenienceConstructed2 = new Rectangle(location.X, location.Y, size.X, size.Y); Assert.AreEqual(standardConstructed.ToString(), convenienceConstructed1.ToString()); Assert.AreEqual(standardConstructed.ToString(), convenienceConstructed2.ToString()); }
public Vector(Vector v) { _x = v._x; _y = v._y; }
Vector _size; // horizontal and vertical diameter stored as a vector for easier manipulation/calculation public Ellipse(Vector location, Vector size) { _location = new Vector(location); _size = new Vector(size); }
// convenience constructor interface can be used if preferred public Ellipse(Vector location, int diameterH, int diameterV) : this(location, new Vector(diameterH, diameterV)) { }
Vector _size; // width and height stored as a vector for easier manipulation/calculation public Rectangle(Vector location, Vector size) { _location = new Vector(location); _size = new Vector(size); }
// convenience constructor interface can be used if preferred public Rectangle(Vector location, int width, int height) : this(location, new Vector(width, height)) { }
public Circle(Vector location, int diameter) { _location = new Vector(location); _diameter = diameter; }
// convenience constructor interface can be used if preferred public Textbox(Vector location, int width, int height, string text) : this(location, new Vector(width, height), text) { }
public Textbox(Vector location, Vector size, string text) { _location = new Vector(location); _size = new Vector(size); _text = text; }
public Square(Vector location, int size) { _location = new Vector(location); _size = size; }