Beispiel #1
0
        public void TestSensHorizontalDroite()
        {
            Position positionTest   = new Position(5, 2);
            SensH    sensHorizontal = positionDeReference.SensHorizontal(positionTest);

            Assert.AreEqual(SensH.DROITE, sensHorizontal);
        }
Beispiel #2
0
        public void TestSensHorizontalGauche()
        {
            Position positionTest   = new Position(-5, 2);
            SensH    sensHorizontal = positionDeReference.SensHorizontal(positionTest);

            Assert.AreEqual(SensH.GAUCHE, sensHorizontal);
        }
Beispiel #3
0
        public void TestSensHorizontalNul()
        {
            Position positionTest   = new Position();
            SensH    sensHorizontal = positionDeReference.SensHorizontal(positionTest);

            Assert.AreEqual(SensH.NUL, sensHorizontal);
        }
Beispiel #4
0
        public void DirectionsTestHorizontalNul()
        {
            sensHorizontal = SensH.NUL;

            Directions direction = new Directions(sensHorizontal);

            Assert.AreEqual(sensHorizontal, direction.sensHorizontal);
        }
Beispiel #5
0
        public void DirectionsTestHorizontalDroite()
        {
            sensHorizontal = SensH.DROITE;

            Directions direction = new Directions(sensHorizontal);

            Assert.AreEqual(sensHorizontal, direction.sensHorizontal);
        }
Beispiel #6
0
        public void DirectionsTestHorizontalGauche()
        {
            sensHorizontal = SensH.GAUCHE;

            Directions direction = new Directions(sensHorizontal);

            Assert.AreEqual(sensHorizontal, direction.sensHorizontal);
        }
Beispiel #7
0
        public void DirectionsTestVerticalBas()
        {
            sensHorizontal = SensH.NUL;
            sensVertical   = SensV.BAS;

            Directions direction = new Directions(sensHorizontal, sensVertical);

            Assert.AreEqual(sensVertical, direction.sensVertical);
        }
Beispiel #8
0
        public void DirectionsTestDirectionBasVertical()
        {
            Random rand = new Random();

            sensVertical   = SensV.BAS;
            sensHorizontal = SensH.NUL;

            Directions direction = new Directions(sensHorizontal, sensVertical);

            Assert.AreEqual(sensVertical, direction.sensVertical);
        }
Beispiel #9
0
        public void DirectionsTestDirectionHautGaucheVertical()
        {
            Random rand = new Random();

            sensVertical   = SensV.HAUT;
            sensHorizontal = SensH.GAUCHE;

            Directions direction = new Directions(sensHorizontal, sensVertical);

            Assert.AreEqual(sensVertical, direction.sensVertical);
        }
Beispiel #10
0
        public void DirectionsTestDirectionDroiteVertical()
        {
            Random rand = new Random();

            sensVertical   = SensV.NUL;
            sensHorizontal = SensH.DROITE;

            Directions direction = new Directions(sensHorizontal, sensVertical);

            Assert.AreEqual(sensVertical, direction.sensVertical);
        }
Beispiel #11
0
        public void PositionTestChangeXLimitePasDroite()
        {
            Position position        = new Position(9, 0);
            int      positionXDepart = position.X;
            SensH    p_sens          = SensH.DROITE;
            int      p_pas           = 5;
            int      p_limite        = 10;

            position.ChangeX(p_sens, p_pas, p_limite);

            Assert.AreEqual(positionXDepart, position.X);
        }
Beispiel #12
0
        public void PositionTestChangeXLimitePasGauche()
        {
            Position position        = new Position(2, 0);
            int      positionXDepart = position.X;
            SensH    p_sens          = SensH.GAUCHE;
            int      p_pas           = 5;
            int      p_limite        = 0;

            position.ChangeX(p_sens, p_pas, p_limite);

            Assert.AreEqual(positionXDepart, position.X);
        }
Beispiel #13
0
        public void PositionTestChangePositionAleatoire()
        {
            Position position1 = new Position();

            Random rand           = new Random();
            SensH  sensHorizontal = SensH.NUL;
            SensV  sensVertical   = SensV.NUL;

            int horizontal = rand.Next(3);
            int vertical   = rand.Next(3);

            switch (horizontal)
            {
            case 1:
                sensHorizontal = SensH.DROITE;
                break;

            case 2:
                sensHorizontal = SensH.GAUCHE;
                break;
            }

            switch (vertical)
            {
            case 1:
                sensVertical = SensV.HAUT;
                break;

            case 2:
                sensVertical = SensV.BAS;
                break;
            }

            int        p_pas     = 1;
            int        p_limite  = 0;
            Directions direction = new Directions(sensHorizontal, sensVertical);

            position1.ChangePosition(direction, p_pas, p_limite);

            Position positionDeReference = new Position();

            if (sensHorizontal == SensH.NUL && sensVertical == SensV.NUL)
            {
                Assert.AreEqual(positionDeReference, position1);
            }
            else
            {
                Assert.AreNotEqual(positionDeReference, position1);
            }
        }
Beispiel #14
0
        public void PositionTestChangePositionDroite()
        {
            Position position1 = new Position(1, 2);

            Random rand           = new Random();
            SensH  sensHorizontal = SensH.DROITE;
            SensV  sensVertical   = SensV.NUL;

            int        p_pas     = 1;
            int        p_limite  = 0;
            Directions direction = new Directions(sensHorizontal, sensVertical);

            position1.ChangePosition(direction, p_pas, p_limite);

            Assert.AreEqual(positionDeReference, position1);
        }
Beispiel #15
0
        public void PositionTestChangePositionBasGauche()
        {
            Position position1 = new Position(3, 1);

            Random rand           = new Random();
            SensH  sensHorizontal = SensH.GAUCHE;
            SensV  sensVertical   = SensV.BAS;

            int        p_pas     = 1;
            int        p_limite  = 0;
            Directions direction = new Directions(sensHorizontal, sensVertical);

            position1.ChangePosition(direction, p_pas, p_limite);


            Assert.AreEqual(positionDeReference, position1);
        }
Beispiel #16
0
        public void PositionTestChangePositionLimiteHautGauche()
        {
            Position position1 = new Position(3, 3);
            Position position2 = new Position(3, 3);

            Random rand           = new Random();
            SensH  sensHorizontal = SensH.GAUCHE;
            SensV  sensVertical   = SensV.HAUT;

            int        p_pas     = 25;
            int        p_limite  = 10;
            Directions direction = new Directions(sensHorizontal, sensVertical);

            position1.ChangePosition(direction, p_pas, p_limite);

            Assert.AreEqual(position2, position1);
        }
Beispiel #17
0
        public void PositionTestChangePositionLimiteBas()
        {
            Position position1 = new Position(2, 1);
            Position position2 = new Position(2, 1);

            Random rand           = new Random();
            SensH  sensHorizontal = SensH.NUL;
            SensV  sensVertical   = SensV.BAS;

            int        p_pas     = 25;
            int        p_limite  = 10;
            Directions direction = new Directions(sensHorizontal, sensVertical);

            position1.ChangePosition(direction, p_pas, p_limite);


            Assert.AreEqual(position2, position1);
        }
Beispiel #18
0
        public void DirectionsTestHorizontalAleatoire()
        {
            Random r = new Random();

            sensHorizontal = SensH.NUL;

            switch (r.Next(3))
            {
            case 1:
                sensHorizontal = SensH.DROITE;
                break;

            case 2:
                sensHorizontal = SensH.GAUCHE;
                break;
            }

            Directions direction = new Directions(sensHorizontal);

            Assert.AreEqual(sensHorizontal, direction.sensHorizontal);
        }
Beispiel #19
0
        public void DirectionsTestTousHorizontal()
        {
            Random rand       = new Random();
            int    horizontal = rand.Next(3);

            sensHorizontal = SensH.NUL;

            switch (horizontal)
            {
            case 1:
                sensHorizontal = SensH.DROITE;
                break;

            case 2:
                sensHorizontal = SensH.GAUCHE;
                break;
            }

            Directions direction = new Directions(sensHorizontal, sensVertical);

            Assert.AreEqual(sensHorizontal, direction.sensHorizontal);
        }
Beispiel #20
0
        public void DirectionsTestVerticalAleatoire()
        {
            Random r = new Random();

            sensHorizontal = SensH.NUL;
            sensVertical   = SensV.NUL;

            switch (r.Next(3))
            {
            case 1:
                sensVertical = SensV.HAUT;
                break;

            case 2:
                sensVertical = SensV.BAS;
                break;
            }

            Directions direction = new Directions(sensHorizontal, sensVertical);

            Assert.AreEqual(sensVertical, direction.sensVertical);
        }
Beispiel #21
0
 public Directions(SensH sensHorizontal = SensH.NUL, SensV sensVertical = SensV.NUL)
 {
     this.sensHorizontal = sensHorizontal;
     this.sensVertical   = sensVertical;
 }
Beispiel #22
0
 public Directions(bool aleatoire = false)
 {
     sensHorizontal = SensH.NUL;
     sensVertical   = SensV.NUL;
 }
Beispiel #23
0
 public Directions()
 {
     sensHorizontal = SensH.NUL;
     sensVertical   = SensV.NUL;
 }