public IActionResult AddRelationToNode([FromBody] NodeRelationRequest relationRequest) { _nodeService.AddChildren(relationRequest.NodeId, relationRequest.ChildrenId); if (relationRequest.AnswerId != 0) { _nodeService.LinkAnswerToNode(relationRequest.AnswerId, relationRequest.ChildrenId); } return(Ok()); }
public void AddRelationToNode() { // Arrange var relationRequest = new NodeRelationRequest() { NodeId = 1, ChildrenId = 2 }; // Act _target.AddRelationToNode(relationRequest); // Assert A.CallTo(() => _nodeService.AddChildren(1, A <int> ._)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _nodeService.LinkAnswerToNode(3, 2)).MustNotHaveHappened(); }