public void MoveLeftTest() { //Assert Axis xAxis = new Axis("x"); Direction positiveDirection = new Direction(DirectionType.Negative); Mover2D mover2D = new Mover2D(); Shape shape = CreateTestShape(); //Act mover2D.Move(shape, xAxis, positiveDirection); //Arrange Assert.IsTrue(shape.Points[0].Equals(new Point2D(new List<Coordinate>() { new Coordinate(4), new Coordinate(5) }))); Assert.IsTrue(shape.Points[1].Equals(new Point2D(new List<Coordinate>() { new Coordinate(4), new Coordinate(6) }))); Assert.IsTrue(shape.Points[2].Equals(new Point2D(new List<Coordinate>() { new Coordinate(5), new Coordinate(6) }))); Assert.IsTrue(shape.Points[3].Equals(new Point2D(new List<Coordinate>() { new Coordinate(5), new Coordinate(7) }))); }
static void Main(string[] args) { Point2D zPoint = new Point2D(new List<Coordinate>(){ new Coordinate(5), new Coordinate(5) }); ZShape z = new ZShape(zPoint); var axes = AxisParser.Parse("axes.xml"); z.Rotate(axes[0]); z.Rotate(axes[1]); Mover2D mover2D = new Mover2D(); Direction negativeDirection = new Direction(DirectionType.Negative); foreach (Point2D item in z.Points) { Console.WriteLine("(" + item.X.Value + ", " + item.Y.Value + ")"); } mover2D.Move(z, axes[0], negativeDirection); Console.WriteLine("-----------------"); foreach (Point2D item in z.Points) { Console.WriteLine("(" + item.X.Value + ", " + item.Y.Value + ")"); } Console.WriteLine("------------------------"); ShapeFactory factory = new ShapeFactory(); var newShape = factory.CreateShape(new Point2D(new List<Coordinate>() { new Coordinate(10), new Coordinate(8) })); foreach (Point2D item in newShape.Points) { Console.WriteLine("(" + item.X.Value + ", " + item.Y.Value + ")"); } }