Beispiel #1
0
        public void MoveTest()
        {
            var e1 = new PT_Camping.Model.Emplacement
            {
                Nom_Emplacement = "e1",
                Cordonnee_X     = 5,
                Coordonnee_Y    = 5
            };
            var graphicLocation = new GraphicLocation(e1);


            //Check position before
            Assert.AreEqual(graphicLocation.Location.Cordonnee_X, 5);
            Assert.AreEqual(graphicLocation.Location.Coordonnee_Y, 5);

            PictureBox pb = new PictureBox
            {
                Width  = 100,
                Height = 100
            };

            graphicLocation.Move(new System.Drawing.PointF(
                                     (float)(graphicLocation.Location.Cordonnee_X + 10),
                                     (float)(graphicLocation.Location.Coordonnee_Y + 25)), pb);

            //Check position after
            Assert.AreEqual(graphicLocation.Location.Cordonnee_X, 15);
            Assert.AreEqual(graphicLocation.Location.Coordonnee_Y, 30);
        }
Beispiel #2
0
        public void ResizeTest()
        {
            var e1 = new PT_Camping.Model.Emplacement
            {
                Nom_Emplacement = "e1",
                Cordonnee_X     = 5,
                Coordonnee_Y    = 5,
                Taille_X        = 50,
                Taille_Y        = 50
            };
            var graphicLocation = new GraphicLocation(e1);


            //Check position before
            Assert.AreEqual(graphicLocation.Location.Taille_X, 50);
            Assert.AreEqual(graphicLocation.Location.Taille_Y, 50);

            PictureBox pb = new PictureBox
            {
                Width  = 100,
                Height = 50
            };

            graphicLocation.Resize(new System.Drawing.SizeF(15, 10), pb);

            //Check position after
            Assert.AreEqual(graphicLocation.Location.Taille_X, 15);
            Assert.AreEqual(graphicLocation.Location.Taille_Y, 20); //picture box height is half sized
        }
Beispiel #3
0
        public void InstanceTest()
        {
            var e1 = new PT_Camping.Model.Emplacement {
                Nom_Emplacement = "e1"
            };
            var graphicLocation = new GraphicLocation(e1);

            Assert.AreEqual(e1, graphicLocation.Location);
            Assert.IsFalse(graphicLocation.Booked);
        }
 public GraphicLocation(Emplacement location)
 {
     Location = location;
     Booked   = false;
     Position = new Rectangle();
 }