public void AddingEdgeOnSceneShouldResultInAddingEdgeInRepo() { var node1 = testModel.CreateElement(testNodeType); var node2 = testModel.CreateElement(testNodeType); ICommand command = new CreateEdgeCommand(model, testEdgeType, node1, node2); command.Execute(); Assert.AreEqual(2, testModel.Nodes.Count()); Assert.AreEqual(1, testModel.Edges.Count()); Assert.AreEqual("aLink", testModel.Edges.First().Name); }
public async Task <IActionResult> CreateEdge([FromBody] CreateEdgeCommand command) { var newValue = await _relationshipService.Create(new CreateRelationshipCommand() { FromType = ObjectType.Asset, FromId = command.Asset1Guid, ToType = ObjectType.Asset, ToId = command.Asset2Guid, Payload = JsonConvert.SerializeObject(new AssetEdgePayloadModel() { Name = command.Name, Asset1Anchor = command.Asset1Anchor, Asset2Anchor = command.Asset2Anchor }) }); if (command.ContainerRootId.HasValue) { _relationshipService.Create(new CreateRelationshipCommand() { FromType = ObjectType.Container, FromId = command.ContainerRootId.Value, ToType = ObjectType.AssetEdge, ToId = newValue.Id }); } return(Ok(newValue)); }
public Relationship CreateEdge(CreateEdgeCommand command) { var newValue = _relationshipService.Create(new CreateRelationshipCommand() { FromType = ObjectType.Asset, FromId = command.Asset1Guid, ToType = ObjectType.Asset, ToId = command.Asset2Guid, CreateByUserId = command.CreateByUserId, Payload = JsonConvert.SerializeObject(new AssetEdgePayloadModel() { Name = command.Name, Asset1Anchor = command.Asset1Anchor, Asset2Anchor = command.Asset2Anchor }) }); if (command.ContainerRootId.HasValue) { _relationshipService.Create(new CreateRelationshipCommand() { FromType = ObjectType.Container, FromId = command.ContainerRootId.Value, ToType = ObjectType.AssetEdge, ToId = newValue.Id, CreateByUserId = command.CreateByUserId }); } return(newValue); }