static void Main(string[] args) { // Create instances from namespace Geometry2D Point2D point2D = new Point2D(); Circle circle = new Circle(); DistanceCalculator2D distance2D = new DistanceCalculator2D(); Ellipse ellipse = new Ellipse(); Figure2D figure2D = new Figure2D(); Polygon polygon = new Polygon(); Rectangle rectangle = new Rectangle(); Square square = new Square(); // Create instances from namespace Geometry3D DistanceCalculator3D distance3D = new DistanceCalculator3D(); Path3D path3D = new Path3D(); Point3D point3D = new Point3D(); // Create instances from namespace Storage GeometryBinaryStorage binaryStorage = new GeometryBinaryStorage(); GeometrySVGStorage svgStorage = new GeometrySVGStorage(); GeometryXMLStorage xmlStorage = new GeometryXMLStorage(); // Create instances from namespace UI Screen2D screen2D = new Screen2D(); Screen3D screen3D = new Screen3D(); }
public void CreateNewTest() { Path2D p1 = new Path2D(); Assert.Equal(0, p1.Figures.Count); Point2D[] points = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Path2D p2 = new Path2D(points); Assert.Equal(1, p2.Figures.Count); Assert.Equal(4, p2.CurrentFigure.Points.Count); Assert.False(p2.CurrentFigure.IsClosed); Path2D p3 = new Path2D(points, true); Assert.True(p3.CurrentFigure.IsClosed); Figure2D figure = new Figure2D(points, true); Path2D p4 = new Path2D(new Figure2D[] { figure }); Assert.Equal(1, p4.Figures.Count); Path2D p5 = new Path2D(new Figure2D[] {}); Assert.Null(p5.CurrentFigure); Assert.Equal(0, p5.Points.Count); }
static void Main(string[] args) { Circle circle = new Circle(); DistanceCalculator2D dist = new DistanceCalculator2D(); Elipse elipse = new Elipse(); Figure2D figure = new Figure2D(); Point2D point = new Point2D(); Polygon plygon = new Polygon(); Rectangle rectangle = new Rectangle(); Square square = new Square(); Console.WriteLine(); Point3D point3D = new Point3D(); Path3D path = new Path3D(); DistanceCalculator3D dist3D = new DistanceCalculator3D(); Console.WriteLine(); GeometryBinaryStorage gbStorage = new GeometryBinaryStorage(); GeometrySVGStorage gsStorage = new GeometrySVGStorage(); GeometryXMLStorage gxStorage = new GeometryXMLStorage(); Console.WriteLine(); Screen2D sc2D = new Screen2D(); Screen3D sc3D = new Screen3D(); }
public void AddPointsTest() { Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points1, false); Assert.Throws <NotSupportedException>(delegate { f1.Points.Add(new Point2D(5, 5)); }); }
public void AddPointsTest() { Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points1, false); Assert.Throws<NotSupportedException>(delegate { f1.Points.Add(new Point2D(5, 5)); }); }
public void ToStringTest() { Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points1); String expected = String.Format("[{0}] Number of {1} points: 4; Closed: False", typeof (Figure2D), typeof (Point2D).Name); Assert.Equal(expected, f1.ToString()); }
public void ToStringTest() { Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points1); String expected = String.Format("[{0}] Number of {1} points: 4; Closed: False", typeof(Figure2D), typeof(Point2D).Name); Assert.Equal(expected, f1.ToString()); }
public void EnumTest() { Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points1); IEnumerator e1 = (f1 as IEnumerable).GetEnumerator(); Assert.NotNull(e1); }
public void CloneTest() { Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points1); Figure <Point2D, Rectangle2D> f2 = f1.Clone(); Figure2D f3 = (f1 as ICloneable).Clone() as Figure2D; Assert.Equal(f1, f2); Assert.Equal(f1, f3); }
public void CreateNewTest() { Point2D[] points = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points, true); Assert.Equal(4, f1.Points.Count); for (Int32 i = 0; i < 4; i++) { Assert.Equal(points[i], f1.Points[i]); } }
public void CurrentFigureTest2() { Point2D[] points = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points, true); Path2D p1 = new Path2D(); p1.NewFigure(points, false); Assert.Throws <InvalidOperationException>(delegate { p1.CurrentFigure = f1; }); }
public void CreateNewTest() { Point2D[] points = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points, true); Assert.Equal(4, f1.Points.Count); for (Int32 i = 0; i < 4; i++) { Assert.Equal(points[i], f1.Points[i]); } }
static void Main(string[] args) { Circle circle = new Circle(); Ellipse ellipse = new Ellipse(); Figure2D figure2D = new Figure2D(); Point2D point = new Point2D(); DistanceCalcualtor2D distanceCalcualtor = new DistanceCalcualtor2D(); Polygon polygon = new Polygon(); Rectangle rectangle = new Rectangle(); Square square = new Square(); DistanceCalculator3D distanceCalculator3D = new DistanceCalculator3D(); Point3D path3D = new Point3D(); Point3D point3D = new Point3D(); Screen2D screen2D = new Screen2D(); Screen3D screen3D = new Screen3D(); }
public void GetHashCodeTest() { Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Path2D p1 = new Path2D(); Path2D p2 = new Path2D(); Path2D p3 = new Path2D(points1); Figure2D f1 = new Figure2D(points1, true); Path2D p4 = new Path2D(points1, true); Path2D p5 = new Path2D(f1); Assert.Equal(p1.GetHashCode(), p2.GetHashCode()); Assert.Equal(p4.GetHashCode(), p5.GetHashCode()); Assert.NotEqual(p1.GetHashCode(), p3.GetHashCode()); Assert.NotEqual(p3.GetHashCode(), p4.GetHashCode()); }
static void Main() { Point2D a = new Point2D(); Figure2D b = new Figure2D(); Square c = new Square(); Rectangle d = new Rectangle(); Circle e = new Circle(); Elipse f = new Elipse(); DistanceCalculator2D g = new DistanceCalculator2D(); Point3D h = new Point3D(); Path3D i = new Path3D(); DistanceCalculator3D j = new DistanceCalculator3D(); GeometryBinaryStorage k = new GeometryBinaryStorage(); GeometrySVGStorage l = new GeometrySVGStorage(); GeometryXMLStorage m = new GeometryXMLStorage(); Screen2D n = new Screen2D(); Screen3D o = new Screen3D(); }
public void EqualityTest() { Path2D p1 = new Path2D(); Path2D p2 = new Path2D(); Assert.True(p1.Equals(p2)); Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Point2D[] points2 = new Point2D[] { new Point2D(0, 0), new Point2D(2, 0), new Point2D(2, 2), new Point2D(0, 2) }; Path2D p3 = new Path2D(points1); Path2D p4 = new Path2D(points1); Assert.True(p3.Equals(p4)); Path2D p5 = new Path2D(p3.CurrentFigure); Assert.True(p3.Equals(p5)); Path2D p6 = new Path2D(points1, true); Assert.False(p3.Equals(p6)); Figure2D f1 = new Figure2D(points1, false); Path2D p7 = new Path2D(new Figure2D[] { f1 }); Assert.True(p3.Equals(p7)); Figure2D f2 = new Figure2D(points2, true); Path2D p8 = new Path2D(new Figure2D[] { f1, f2 }); Assert.False(p3.Equals(p8)); p3.NewFigure(points2, true); Assert.True(p8.Equals(p3)); p8 = null; Assert.False(p3.Equals(p8)); Assert.False(p3.Equals(new Object())); }
public void CurrentFigureTest1() { Point2D[] points = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points, true); Path2D p1 = new Path2D(f1); f1 = p1.CurrentFigure as Figure2D; Assert.Equal(4, p1.Points.Count); p1.NewFigure(points, false); Assert.Same(p1.CurrentFigure, p1.Figures[1]); p1.CurrentFigure = f1; Assert.Same(p1.CurrentFigure, f1); Path2D p2 = new Path2D(); Assert.Null(p2.CurrentFigure); Assert.Equal(0, p2.Points.Count); }
public void CurrentFigureTest1() { Point2D[] points = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Figure2D f1 = new Figure2D(points, true); Path2D p1 = new Path2D(f1); f1 = p1.CurrentFigure as Figure2D; Assert.Equal(4, p1.Points.Count); p1.NewFigure(points, false); Assert.Same(p1.CurrentFigure, p1.Figures[1]); p1.CurrentFigure = f1; Assert.Same(p1.CurrentFigure, f1); Path2D p2 = new Path2D(); Assert.Null(p2.CurrentFigure); Assert.Equal(0, p2.Points.Count); }
public void CreateNewTest() { Path2D p1 = new Path2D(); Assert.Equal(0, p1.Figures.Count); Point2D[] points = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Path2D p2 = new Path2D(points); Assert.Equal(1, p2.Figures.Count); Assert.Equal(4, p2.CurrentFigure.Points.Count); Assert.False(p2.CurrentFigure.IsClosed); Path2D p3 = new Path2D(points, true); Assert.True(p3.CurrentFigure.IsClosed); Figure2D figure = new Figure2D(points, true); Path2D p4 = new Path2D(new Figure2D[] {figure}); Assert.Equal(1, p4.Figures.Count); Path2D p5 = new Path2D(new Figure2D[] {}); Assert.Null(p5.CurrentFigure); Assert.Equal(0, p5.Points.Count); }
static void Main() { Circle circle = new Circle(); Ellipse ellipse = new Ellipse(); DistanceCalculator2D calc2D = new DistanceCalculator2D(); Figure2D figure2D = new Figure2D(); Point2D p2D = new Point2D(); Polygon polygon = new Polygon(); Rectangle rect = new Rectangle(); Square square = new Square(); Console.WriteLine(); DistanceCalculator3D calc3D = new DistanceCalculator3D(); Path3D path = new Path3D(); Point3D p3D = new Point3D(); GeometrySVGStorage geometrySVGStorage = new GeometrySVGStorage(); GeometryXMLStorage geometryXMLStorage = new GeometryXMLStorage(); GeometryBinaryStorage geometryBinaryStorage = new GeometryBinaryStorage(); Screen2D scr2D = new Screen2D(); Screen3D scr3D = new Screen3D(); }
public void EqualityTest() { Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Point2D[] points2 = new Point2D[] {new Point2D(0, 0), new Point2D(2, 0), new Point2D(2, 2), new Point2D(0, 2)}; Point2D[] points3 = new Point2D[] {new Point2D(0, 0), new Point2D(2, 0), new Point2D(2, 2), new Point2D(0, 2), new Point2D(0, 2)}; Figure2D f1 = new Figure2D(points1, true); Figure2D f2 = new Figure2D(points1, true); Figure2D f3 = new Figure2D(points1); Figure2D f4 = new Figure2D(points2, true); Figure2D f5 = new Figure2D(points3, true); Assert.Equal(f1, f2); Assert.NotEqual(f1, f3); Assert.NotEqual(f1, f4); Assert.NotEqual(f4, f5); Assert.False(f1.Equals(new Object())); f2 = null; Assert.False(f1.Equals(f2)); }
public void EqualityTest() { Point2D[] points1 = new Point2D[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1) }; Point2D[] points2 = new Point2D[] { new Point2D(0, 0), new Point2D(2, 0), new Point2D(2, 2), new Point2D(0, 2) }; Point2D[] points3 = new Point2D[] { new Point2D(0, 0), new Point2D(2, 0), new Point2D(2, 2), new Point2D(0, 2), new Point2D(0, 2) }; Figure2D f1 = new Figure2D(points1, true); Figure2D f2 = new Figure2D(points1, true); Figure2D f3 = new Figure2D(points1); Figure2D f4 = new Figure2D(points2, true); Figure2D f5 = new Figure2D(points3, true); Assert.Equal(f1, f2); Assert.NotEqual(f1, f3); Assert.NotEqual(f1, f4); Assert.NotEqual(f4, f5); Assert.False(f1.Equals(new Object())); f2 = null; Assert.False(f1.Equals(f2)); }
public void CurrentFigureTest2() { Point2D[] points = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points, true); Path2D p1 = new Path2D(); p1.NewFigure(points, false); Assert.Throws<InvalidOperationException>(delegate { p1.CurrentFigure = f1; }); }
public void GetHashCodeTest() { Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Path2D p1 = new Path2D(); Path2D p2 = new Path2D(); Path2D p3 = new Path2D(points1); Figure2D f1 = new Figure2D(points1, true); Path2D p4 = new Path2D(points1, true); Path2D p5 = new Path2D(f1); Assert.Equal(p1.GetHashCode(), p2.GetHashCode()); Assert.Equal(p4.GetHashCode(), p5.GetHashCode()); Assert.NotEqual(p1.GetHashCode(), p3.GetHashCode()); Assert.NotEqual(p3.GetHashCode(), p4.GetHashCode()); }
public void EqualityTest() { Path2D p1 = new Path2D(); Path2D p2 = new Path2D(); Assert.True(p1.Equals(p2)); Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Point2D[] points2 = new Point2D[] {new Point2D(0, 0), new Point2D(2, 0), new Point2D(2, 2), new Point2D(0, 2)}; Path2D p3 = new Path2D(points1); Path2D p4 = new Path2D(points1); Assert.True(p3.Equals(p4)); Path2D p5 = new Path2D(p3.CurrentFigure); Assert.True(p3.Equals(p5)); Path2D p6 = new Path2D(points1, true); Assert.False(p3.Equals(p6)); Figure2D f1 = new Figure2D(points1, false); Path2D p7 = new Path2D(new Figure2D[] {f1}); Assert.True(p3.Equals(p7)); Figure2D f2 = new Figure2D(points2, true); Path2D p8 = new Path2D(new Figure2D[] {f1, f2}); Assert.False(p3.Equals(p8)); p3.NewFigure(points2, true); Assert.True(p8.Equals(p3)); p8 = null; Assert.False(p3.Equals(p8)); Assert.False(p3.Equals(new Object())); }
public void CloneTest() { Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points1); Figure<Point2D, Rectangle2D> f2 = f1.Clone(); Figure2D f3 = (f1 as ICloneable).Clone() as Figure2D; Assert.Equal(f1, f2); Assert.Equal(f1, f3); }
public void EnumTest() { Point2D[] points1 = new Point2D[] {new Point2D(0, 0), new Point2D(1, 0), new Point2D(1, 1), new Point2D(0, 1)}; Figure2D f1 = new Figure2D(points1); IEnumerator e1 = (f1 as IEnumerable).GetEnumerator(); Assert.NotNull(e1); }