示例#1
0
        public void NumbersAddUpCorrectly()
        {

            DrawShape se = new DrawShape();
            int expected = 12;
            int actual = se.add(7, 5);

            Assert.AreEqual(expected, actual, "The values are not equal");

        }
示例#2
0
文件: Form1.cs 项目: the455/PSPM
        public void DrawMesh(String File_Name = "Mesh.csv")
        {
            //Should have a check to make sure the mesh fits in the screen

            if (blobDrawn)
            {
                // TODO: check if mesh is null. If it is then just draw mesh if it isn't redraw blob from save file and redraw mesh
                ClearDrawings();
                DrawBlob("Blob.csv");
                //DrawMesh();
                //blobDrawn
            }
            //  if (OpenMeshFile)
            //  {
            ReadFile(File_Name);
            // }
            // else
            // {
            //     ReadFile("Mesh.csv");
            // }
            //OpenMeshFile = false;

            DrawShape drawShape = new DrawShape();
            Graphics g = this.CreateGraphics();

            if (shapes[0].Equals("Square"))
            {
                shapeList = drawShape.DrawSquare(g, shapeList, this.Width, this.Height, sizes, numbers, shapes);
                if (mesh != null)
                {
                    //Compare("Square");
                }
            }
            else if (shapes[0].Equals("Triangle"))
            {
                //shapeFactory.getShape(shapes[0]);
                // MessageBox.Show("Triangle!");
                shapeList = drawShape.DrawTriangle(g, shapeList, this.Width, this.Height, sizes, numbers, shapes);
                if (mesh != null)
                {
                    //Compare("Triangle");
                }
            }
            else if (shapes[0].Equals("Hexagon"))
            {
                shapeFactory.getShape(shapes[0]);
                //MessageBox.Show("Hexagon!");
                shapeList = drawShape.DrawHexagon(g, shapeList, this.Width, this.Height, sizes, numbers, shapes);
                Logger.Debug(shapeList.ElementAt(0).toString());
                // Compare("Hexagon");
                //Need to implement method for drawing hexagons
            }
            else
            {
                MessageBox.Show("The temporary files has been modified\nPlease generate a new mesh", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }