Exemplo n.º 1
0
        protected PathSection getPathSection(bool IsL2R, bool isTough = false)
        {
            InitParams    init        = new InitParams();
            ColoBox       box         = new ColoBox("", 1);
            Machine       machine     = new Machine(init, box);
            PathSection   pathSection = new PathSection(machine);
            DirectionBase direction   = null;

            if (IsL2R)
            {
                direction = new DirectionL2R(machine);
            }
            else
            {
                direction = new DirectionR2L(machine);
            }

            LayoutManager layoutManager = new LayoutManager(init);

            layoutManager.LocationMachine   = machine;
            machine.direction               = direction;
            machine.direction.LayoutManager = layoutManager;
            if (isTough)
            {
                machine.BorderVerifier = getToughBorderVerifier(direction, machine);
            }
            else
            {
                machine.BorderVerifier = getBorderVerifier(direction, machine);
            }

            return(pathSection);
        }
Exemplo n.º 2
0
        public void Y_TouchesBorderR2L_below_Limits_Negative()
        {
            //arrange
            DirectionR2L direction           = new DirectionR2L();
            double       maxY                = -520.92;
            ColoBox      currentBoxReference = getBox(maxY);
            TiltBorder   b = getBorder(direction, typeof(FirstBorderNegative));

            //act
            double result = direction.GetYPointTouchesBorder(currentBoxReference, typeof(FirstBorderNegative), b);

            //assert
            Assert.AreEqual(result, maxY);
        }
Exemplo n.º 3
0
        public void SortSectionOrderR2L()
        {
            //arrange
            List <Border> lst = new List <Border>();

            lst.Add(new Border {
                Coordinate = 639.3339
            });
            lst.Add(new Border {
                Coordinate = 193.9599
            });
            lst.Add(new Border {
                Coordinate = 638.5776
            });
            DirectionR2L direction = new DirectionR2L();

            //act
            List <Border> result = direction.SortLookaheadPath(lst);

            //assert
            Assert.AreEqual(result[0].Coordinate, 639.3339);
            Assert.AreEqual(result[1].Coordinate, 638.5776);
            Assert.AreEqual(result[2].Coordinate, 193.9599);
        }