public void TakeOverBoundingContainerWithCircleSmallTopLeft() { //preconfig int cols = 10; int rows = 10; int width = 100; int height = 100; int expectedFieldHeight = height / rows; int expectedFieldWidth = width / cols; int radius1 = 5; Vector position1 = new Vector(0, 0); //creation BoundingRaster br = new BoundingRaster(cols, rows, width, height); Bumper parent1 = new Bumper(); BoundingCircle bC1 = new BoundingCircle(radius1, position1); BoundingContainer bCont1 = new BoundingContainer(parent1); bCont1.AddBoundingBox(bC1); parent1.Location = (new Vector(0, 0)); //operation br.TakeOverBoundingContainer(bCont1); //assertion for (int x = 0; x < cols; x++) { for (int y = 0; y < rows; y++) { if (x <= 1 && x >= 0 && y <= 1 && y >= 0) { bool found = false; foreach (IBoundingBox b in br.GetBoundingField(x, y).getReferences()) { Assert.AreEqual(bC1, b); found = true; } if (!found) { Assert.Fail(); } } else { foreach (IBoundingBox b in br.GetBoundingField(x, y).getReferences()) { if (bC1.Equals(b)) { Assert.Fail(); } } } } } }
public void TakeOverBoundingContainerWithCircleBigTotalOutside() { //preconfig int cols = 10; int rows = 10; int width = 100; int height = 100; int expectedFieldHeight = height / rows; int expectedFieldWidth = width / cols; int radius1 = 5; Vector position1 = new Vector(-20, -20); //creation BoundingRaster br = new BoundingRaster(cols, rows, width, height); Bumper parent1 = new Bumper(); BoundingCircle bC1 = new BoundingCircle(radius1, position1); BoundingContainer bCont1 = new BoundingContainer(parent1); bCont1.AddBoundingBox(bC1); parent1.Location = (new Vector(0, 0)); //operation br.TakeOverBoundingContainer(bCont1); //assertion for (int x = 0; x < cols; x++) { for (int y = 0; y < rows; y++) { foreach (IBoundingBox b in br.GetBoundingField(x, y).getReferences()) { if (bC1.Equals(b)) { Assert.Fail(); } } } } }