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); }
public void Y_TouchesBorderL2R_in_Limits_Negative() { //arrange DirectionL2R direction = new DirectionL2R(); double maxY = -400.92; ColoBox currentBoxReference = getBox(maxY); TiltBorder b = getBorder(direction, typeof(FirstBorderNegative)); //act double result = direction.GetYPointTouchesBorder(currentBoxReference, typeof(FirstBorderNegative), b); //assert Assert.AreEqual(result, -420.92); }
public void SortSectionOrderL2R() { //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 }); DirectionL2R direction = new DirectionL2R(); //act List <Border> result = direction.SortLookaheadPath(lst); //assert Assert.AreEqual(result[0].Coordinate, 193.9599); Assert.AreEqual(result[1].Coordinate, 638.5776); Assert.AreEqual(result[2].Coordinate, 639.3339); }