public void TestAreaOfHexagonIsCalculatedIncorrectly() { General g = new General(); Point[] p = new Point[6]; p[0].X = 30; p[0].Y = 86; p[1].X = 58; p[1].Y = 38; p[2].X = 114; p[2].Y = 38; p[3].X = 142; p[3].Y = 86; p[4].X = 114; p[4].Y = 134; p[5].X = 58; p[5].Y = 134; int actual = g.AreaOfHexagon(p); int expected = 100; Assert.AreNotEqual(expected, actual, "The values are not equal"); }
public void TestAreaOfSquareIsCalculatedCorrectly() { General g = new General(); Point[] p = new Point[2]; p[0].X = 10; p[0].Y = 15; p[1].X = 35; p[1].Y = 40; int actual = g.AreaOfSquare(p); int expected = 625; Assert.AreEqual(expected, actual, "The values are not equal"); }
public void TestPercentageIsCalculatedIncorrectly() { General g = new General(); int actual = g.CalcualtePercentage(23, 100); int expected = 54; Assert.AreNotEqual(expected, actual, "The values are not equal"); }
public void TestMidPointOfLineIsIncorrect() { General g = new General(); int expected = 95; int actual = g.FindMidPointBetweenTwoPoints(60, 100); Assert.AreNotEqual(expected, actual, "Correct answer is not produced"); }
public void TestAreaOfTriangleIsCalculatedIncorrectly() { General g = new General(); Point[] p = new Point[3]; p[0].X = 30; p[0].Y = 30; p[1].X = 57; p[1].Y = 76; p[2].X = 84; p[2].Y = 30; int actual = g.AreaOfTriangle(p); int expected = 100; Assert.AreNotEqual(expected, actual, "The values are not equal"); }
public List<Shapes> DrawTriangle(Graphics g, List<Shapes> shapeList, int Width, int Height, Sizes sizes, int[] numbers, String[] shapes) { General general = new General(); shapeList = new List<Shapes>(); Shapes triangle; int[] xArray = new int[3]; int[] yArray = new int[3]; Pen myPen = new Pen(System.Drawing.Color.Black, 1); //Left most point to resume drawing at the level below Point leftMostPoint = new Point(); //Set up general parameters int offset = sizes.OFFSET; int maxWidth = Width; int maxHeight = Height - sizes.STATUS_BAR - offset; int sliderModifier = numbers[4]; int SizeChange = numbers[2] + sliderModifier; int pythagHeight = coordinateGeometry.Pythagoras(SizeChange, (SizeChange / 2)); //first enum value MovingPointTriangle value = MovingPointTriangle.Point0; //Downward facing triangle first so you know the point will always be in the form then //Need to use 3 points and then drawPolygon //Draw the inital triangle, special case Point[] point = new Point[3]; point[0].X = offset; point[0].Y = offset; point[1].X = offset + SizeChange / 2; point[1].Y = offset + pythagHeight; point[2].X = offset + SizeChange; point[2].Y = offset; Boolean up = false; Boolean upOuter = false; do { leftMostPoint = coordinateGeometry.CheckForLowestPoint(point); g.DrawPolygon(myPen, point); //Create shape object for triangle xArray = FillXArray(point, xArray); yArray = FillYArray(point, yArray); triangle = shapeFactory.getShape(shapes[0]); triangle.setPoints(xArray, yArray); shapeList.Add(triangle); do { switch (value) { case MovingPointTriangle.Point0: point[0] = coordinateGeometry.TriangleModifier(up, point[0], SizeChange, pythagHeight); up = FlipBoolean(up); value = MovingPointTriangle.Point1; break; case MovingPointTriangle.Point1: point[1] = coordinateGeometry.TriangleModifier(up, point[1], SizeChange, pythagHeight); up = FlipBoolean(up); value = MovingPointTriangle.Point2; break; case MovingPointTriangle.Point2: point[2] = coordinateGeometry.TriangleModifier(up, point[2], SizeChange, pythagHeight); up = FlipBoolean(up); value = MovingPointTriangle.Point0; break; } g.DrawPolygon(myPen, point); xArray = FillXArray(point, xArray); yArray = FillYArray(point, yArray); triangle = shapeFactory.getShape(shapes[0]); triangle.setPoints(xArray, yArray); shapeList.Add(triangle); } while (general.CheckWidth(maxWidth, SizeChange, point, sizes)); value = MovingPointTriangle.Point0; if (upOuter) { point = coordinateGeometry.PointingDownwardsTriangle(point, leftMostPoint, pythagHeight, SizeChange, offset); up = false; } else { point = coordinateGeometry.PointingUpwardsTriangle(point, leftMostPoint, pythagHeight, SizeChange); up = true; } upOuter = FlipBoolean(upOuter); } while (general.CheckHeight(maxHeight, SizeChange, point)); return shapeList; }
private string simplicityPercentage() { string s = ""; General g = new General(); MeshSettings m = new MeshSettings(); int percentage = g.CalcualtePercentage(numbers[4], m.tb_Thickness.Maximum); s = String.Format("The mesh finess is at {0}%", percentage); return s; }