static void Main() { Path testPath = new Path(); //creates a Path class instance testPath = PathStorage.LoadPath(@"..\..\InputPath.txt"); //test method loading a path of points from specified file Console.WriteLine(testPath.ToString()); //test method Path.ToString() testPath.Add(Point3D.PointZero); //test constant PointZero (0,0,0) Console.WriteLine(testPath.ToString()); testPath.RemoveAt(0); //test remove the first point from the path Console.WriteLine(testPath.ToString()); PathStorage.SavePath(testPath, @"..\..\OutputPath.txt"); //test save the path to file Console.WriteLine("The distance between {0} and {1} is: {2}", new Point3D(3.2, 3.5, 3.0), Point3D.PointZero, Distance3D.CalcDistance3D(new Point3D(3.2, 3.5, 3.0), Point3D.PointZero)); //tests the calculation of the distance between two 3D points }
static void Main() { // Explanation Console.WriteLine("Hello! This program tests the functionality of the ThreeDimensionalSpace project. It will run a few tests to determine if the code has been written correctly. Enjoy!"); Console.WriteLine(); // Testing PointZero property Console.WriteLine("Testing PointZero property:"); Console.WriteLine(Point3D.PointZero); Console.WriteLine(); // Testing calculation of distance between two points in 3D space Console.WriteLine("Testing calculation of distance between two points in 3D space:"); Console.WriteLine(CalcDistance.Calculate(new Point3D(1, -3, 6), new Point3D(2, 5, -15))); Console.WriteLine(); // Testing Path class Console.WriteLine("Testing Path class. Creating new instance of the Path class and adding three points with different coordinates to it."); Path testPath = new Path(); testPath.AddPoint(new Point3D(15, 3, 6)); testPath.AddPoint(new Point3D(-5, 6, 15)); testPath.AddPoint(new Point3D(3, 4, 200)); Console.WriteLine("This is the path contained in the test instance of the Path class:"); foreach (var point in testPath.Points) { Console.WriteLine(point); } Console.WriteLine(); // Testing path saving method of the PathStorage class Console.WriteLine("Testing the path saving method of the PathStorage class:"); PathStorage.SavePath(testPath); Console.WriteLine("Save successful. Look for PathStorage.txt in the project directory."); Console.WriteLine(); // Testing path loading method of the PathStorage class Console.WriteLine("Testing the path loading method of the PathStorage class:"); Path loadedPath = PathStorage.LoadPath(null); Console.WriteLine("This is the loaded path:"); foreach (var point in loadedPath.Points) { Console.WriteLine(point); } Console.WriteLine(); Console.WriteLine("The test of the ThreeDimensionalSpace project has been completed successfully! Have a nice day!"); }
/// <summary> /// Adds a path to the already existing path without overwriting /// </summary> /// <param name="pathToAdd"></param> public void PathAddPath(Path pathToAdd) { this.path.AddRange(pathToAdd.PathGet); }