public void TestInitialize() { this.dbStub = new HatchlingCompanyDbContext(Effort.DbConnectionFactory.CreateTransient()); this.writerStub = new Mock <IWriter>(); this.mapperStub = new Mock <IMapper>(); this.createRelationshipService = new CreateRelationship(dbStub, writerStub.Object, mapperStub.Object); }
protected ITransactionOperation CreateTransactionOperation(TransactionType transactionType) { ITransactionOperation transactionOperation; switch (transactionType) { case TransactionType.CreateNode: transactionOperation = new CreateNode(MapObjects.Parameters); break; case TransactionType.DeleteNode: transactionOperation = new DeleteNode(MapObjects.Parameters); break; case TransactionType.CreateRelationship: transactionOperation = new CreateRelationship(MapObjects.Parameters); break; case TransactionType.DeleteRelationship: transactionOperation = new DeleteRelationship(MapObjects.Parameters); break; case TransactionType.CreateDescriptor: transactionOperation = new CreateDescriptor(MapObjects.Parameters); break; case TransactionType.CreateMetadata: transactionOperation = new CreateMetadata(MapObjects.Parameters); break; case TransactionType.UpdateMetadata: transactionOperation = new UpdateMetadata(MapObjects.Parameters); break; case TransactionType.DeleteMetadata: transactionOperation = new DeleteMetadata(MapObjects.Parameters); break; case TransactionType.UpdateNode: transactionOperation = new UpdateNode(MapObjects.Parameters); break; case TransactionType.UpdateRelationship: transactionOperation = new UpdateRelationship(MapObjects.Parameters); break; case TransactionType.UpdateDescriptor: transactionOperation = new UpdateDescriptor(MapObjects.Parameters); break; default: throw new NotSupportedException("The requested transaction type doesn't exist."); } return(transactionOperation); }
public void ToolMouseUp(object sender, MouseEventArgs e) { if (this.line != null) { if (e.Button == MouseButtons.Left) { if (canvas.GetObjectAt(e.X, e.Y) is Vertex && canvas.GetObjectAt(e.X, e.Y) != StartingObject) { EndingObject = (Vertex)canvas.GetObjectAt(e.X, e.Y); foreach (Edge edge in StartingObject.GetEdgeList()) { if (edge.GetEndVertex() == EndingObject || edge.GetStartVertex() == EndingObject) { canvas.RemoveDrawingObject(line); line = null; break; } } if (line != null) { line.Endpoint = new System.Drawing.Point(EndingObject.X, (EndingObject.Height / 2) + EndingObject.Y); line.Select(); StartingObject.Subscribe(line); line.AddVertex(StartingObject); EndingObject.Subscribe(line); line.AddVertex(EndingObject); ICommand command = new CreateRelationship(line, canvas); canvas.AddCommand(command); canvas.SetSelectedObject(line); canvas.DeselectAllObjects(); line.Select(); } } else if (!(canvas.GetSelectedObject() is Edge) || !(canvas.GetObjectAt(e.X, e.Y) is Vertex)) { if (line != null) { canvas.RemoveDrawingObject(this.line); } } line = null; } /*else if (e.Button == MouseButtons.Right) * { * canvas.RemoveDrawingObject(this.line); * }*/ } }
private string GenerateRelationship(CreateRelationship relationship) { var scriptBuilder = new StringBuilder(); scriptBuilder.Append('(').Append(relationship.NodeId1).Append(")-["); scriptBuilder.Append(GetLabels(relationship.Labels)); if (relationship.Properties.Any()) { scriptBuilder.Append(GetProperties(relationship.Properties)); } scriptBuilder.Append("]->(").Append(relationship.NodeId2).Append(")"); return(scriptBuilder.ToString()); }
public string Create(CreateRelationship relationship) => CREATE + GenerateRelationship(relationship);