public void DeleteByRadiusCommandRedo() { AddControlPointCommand command = new AddControlPointCommand(this.LineSketchObject, new Vector3(1, 2, 3)); Invoker.ExecuteCommand(command); command = new AddControlPointCommand(this.LineSketchObject, new Vector3(2, 3, 4)); Invoker.ExecuteCommand(command); command = new AddControlPointCommand(this.LineSketchObject, new Vector3(3, 3, 3)); Invoker.ExecuteCommand(command); command = new AddControlPointCommand(this.LineSketchObject, new Vector3(4, 3, 2)); Invoker.ExecuteCommand(command); ICommand deleteCommand = new DeleteControlPointsByRadiusCommand(this.LineSketchObject, new Vector3(3, 3.5f, 3), .6f); Invoker.ExecuteCommand(deleteCommand); Invoker.Undo(); Invoker.Redo(); Assert.AreEqual(2, this.LineSketchObject.getNumberOfControlPoints()); Assert.AreEqual((2 + 2) * 7, this.LineSketchObject.GetComponent <MeshFilter>().sharedMesh.vertices.Length); LineSketchObject[] lines = GameObject.FindObjectsOfType <LineSketchObject>(); Assert.AreEqual(2, lines.Length); foreach (LineSketchObject line in lines) { if (line != this.LineSketchObject) { Assert.AreEqual(1, line.getNumberOfControlPoints()); Assert.AreEqual(new Vector3(4, 3, 2), line.GetControlPoints()[0]); } } }
public void DeleteByRadiusCommand() { AddControlPointCommand command = new AddControlPointCommand(this.LineSketchObject, new Vector3(1, 2, 3)); Invoker.ExecuteCommand(command); command = new AddControlPointCommand(this.LineSketchObject, new Vector3(2, 3, 4)); Invoker.ExecuteCommand(command); command = new AddControlPointCommand(this.LineSketchObject, new Vector3(3, 3, 3)); Invoker.ExecuteCommand(command); command = new AddControlPointCommand(this.LineSketchObject, new Vector3(4, 3, 2)); Invoker.ExecuteCommand(command); ICommand deleteCommand = new DeleteControlPointsByRadiusCommand(this.LineSketchObject, new Vector3(3, 3.5f, 3), .6f); Invoker.ExecuteCommand(deleteCommand); Assert.AreEqual(2, this.LineSketchObject.getNumberOfControlPoints()); Assert.AreEqual((2 + 2) * 7, this.LineSketchObject.GetComponent <MeshFilter>().sharedMesh.vertices.Length); }