Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
 public Vector(Vector v)
 {
     _x = v._x;
     _y = v._y;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 // convenience constructor interface can be used if preferred
 public Ellipse(Vector location, int diameterH, int diameterV)
     : this(location, new Vector(diameterH, diameterV))
 {
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 // convenience constructor interface can be used if preferred
 public Rectangle(Vector location, int width, int height)
     : this(location, new Vector(width, height))
 {
 }
Esempio n. 8
0
 public Circle(Vector location, int diameter)
 {
     _location = new Vector(location);
     _diameter = diameter;
 }
Esempio n. 9
0
 // 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)
 {
 }
Esempio n. 10
0
 public Textbox(Vector location, Vector size, string text)
 {
     _location = new Vector(location);
     _size = new Vector(size);
     _text = text;
 }
Esempio n. 11
0
 public Square(Vector location, int size)
 {
     _location = new Vector(location);
     _size = size;
 }